How to use when condition in ansible yaml file? – CentOS
I want something like: if env == 'dev' - hosts: "{{host}}" user: root else if env == 'prod' - hosts: "{{host}}" user: centos How to do that?
I want something like: if env == 'dev' - hosts: "{{host}}" user: root else if env == 'prod' - hosts: "{{host}}" user: centos How to do that?
I am running myserver in ubuntu: + sudo cat /etc/os-release NAME="Ubuntu" VERSION="16.04.6 LTS (Xenial Xerus)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 16.04.6 LTS" VERSION_ID="16.04" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" VERSION_CODENAME=xenial UBUNTU_CODENAME=xenial I use ansible and when I run it I get the following error: fatal:…
Declared YUM task as below: --- - hosts: all vars: tasks: - name: install package yum: name: ntp state: present Ran following command: ansible-playbook test.yml -i localhost, --connection=local -vvvv Receiving error message: TASK [install package] *************************************************************************************************************************************************** task path: /home/osuser/dod/test.yml:6 Using…
I am setting up a web service that is reachable over HTTPS and it uses an internal CA. I want Ansible to verify the certificate so I need to make it trust this CA. I am running Ansible on both…
I am trying to use ansible to modify the hostnames of a dozen newly created Virtual Machines, and I am failing to understand how to loop correctly. Here is the playbook I've written: --- - hosts: k8s_kvm_vms tasks: - name:…
I am running a simple playbook to test setting up K8s, step one is to turn off swap, which requires elevation to succeed. I have ansible installed on one ubuntu docker container, trying to run the play on another centos…
Scenario I want to develop ansible roles. Those roles should be validated through a CI/CD process with molecule and utilize docker as driver. This validation step should include multiple Linux flavours (e.g. centos/ubuntu/debian) times the supported ansible versions. The tests…
I run Ansible task on remote Windows hosts. I want recieve result messages by Telegram, but by default these hosts not contains python, and Telegram module don't work. How i can run it locally? For example... - hosts: winservers vars:…
My goal is to use ansible to turn off this "windows feature" that can be found on a windows machine by searching "Turn Windows features on or off" and going down to SMB 1.0/CIFS File Sharing Support. Something is wrong…
I have followed things suggested in different resources.. most of them suggests mentioned here ansible yum not working - name: Update a package with the latest version yum: name: package_name enablerepo: enable_required_repo state: latest I get following error fatal: [hostname]:…