New answers tagged

0

An alternative sintax to Dilson Rainov's answer, more ansible 2.x style (I think). In your inventory define the host as: vagrant-local: ansible_host: 192.168.33.10 ansible_user: vagrant ansible_ssh_private_key_file: .vagrant/machines/default/virtualbox/private_key UserKnownHostsFile: /dev/null StrictHostKeyChecking: no ...


1

The answer is in the warning you get: [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' When you use hosts: all in your playbook, localhost is not matched. If you want to run the playbook on localhost, you can do one of the following: Change your playbook to hosts: localhost. ...


1

This error is due to invalid value of ansible_network_os: The playbook you try setup is meant for network devices. And since centos is not a network device OS the playbook will fail. Here you can find supported network OS. Ansible Documentation: ansible_network_os values If you don't have any device running a supported network OS I recommend you to follow ...


0

nicholas $ nicholas $ cat ansible.cfg [defaults] inventory = hosts ask_vault_pass = True [privilege_escalation] become_ask_pass = True nicholas $ nicholas $ sudo ansible-playbook first_playbook.yml --connection=local BECOME password: Vault password: [WARNING]: Unable to parse /home/nicholas/ansible/hosts as an inventory source [WARNING]: No inventory ...


0

I believe your hosts is set to k8s01 or other group not containing k8s02 and k8s03. That's why they are not run. You shall add with_items: "{{ groups['managers'] }}" and delegate as you done in the second task -name: Set join command for managers. - name: Join managers into cluster shell: "{{ kubernetes_join_command_controlplane.stdout ...


0

Set HTTP_X_FORWARDED_FOR extra header as allowed in settings and you should be good. https://github.com/ansible/awx/issues/8005


0

Not to contradict anything written in @Ceshadri_C's answer, but to focus more on the difference between facts and variables - perhaps the variable precedence page could be of greater insight. The difference between facts and variables set is defined by their precedence, i.e. all variables are important, but some variables are more important than others. In ...


2

Ansible facts are data collected about the (target) systems on which Ansible takes actions. They are variables, but set by Ansible (in a way like system defined variables). They are collected during Gathering Facts stage of a playbook run, and it is controlled by the gather_facts setting. Ansible calls this variables discovered from systems. That said, it is ...


1

The condition works as expected. For example, the inventory and the playbook below shell> cat hosts [managers] k8s01 k8s02 k8s03 [workers] worker1 worker2 shell> cat playbook.yml - hosts: all gather_facts: false tasks: - debug: var: inventory_hostname when: - inventory_hostname != groups.managers.0 - ...


2

The simple answer is "yes" you can use Ansible for monitoring configuration, but you will have to do some extra work. As Vasily stated in their answer, Ansible does not have a built in triggering mechanism, so you need something to trigger the convergence of state. This can be done in several ways, the easiest being probably ansible-pull. As the ...


0

Ansible is not state manager like Terraform but just automation tool. I think the only way to keep state A configuration is run ansible in cron. I saw such use case with chef automation tool.


Top 50 recent answers are included