Hot answers tagged

4

While it's true that the version of python reported there doesn't have SNI support, I thought that RedHat backported it. But anyways, if not, you can do that yourself: yum -y install gcc python-devel libffi-devel openssl-devel pip install pyopenssl ndg-httpsclient pyasn1 (This works for requests at least, I'm not sure about Ansible.) On a broader note: ...


4

Use this source code for reboot your client machine --- - name: System Reboot hosts: debian become_method: sudo become_user: root become: true tasks: - name: reboot nodes # Reboot client side debian machine shell: sleep 2 && shutdown -r now "Ansible reboot" async: 1 poll: 0 ...


3

https://docs.ansible.com/ansible/latest/modules/reboot_module.html - name: Unconditionally reboot the machine with all defaults reboot: - name: Reboot a slow machine that might have lots of updates to apply reboot: reboot_timeout: 3600


2

Use the --limit option to select a subset of hosts: ansible-playbook -i /path test.yml --tags automation --limit host2 Its description from ansible-playbook documentation: further limit selected hosts to an additional pattern


2

Using systemd in Docker is not really that straightforward. However, according to the doc on the docker hub, systemd is now included in both the centos:7 and centos:latest base containers. However, you will need to include text similar to the example Dockerfile : FROM centos:7 ENV container docker RUN (cd /lib/systemd/system/sysinit.target.wants/; for i ...


2

You have this in your config file: [inventory] enable_plugins = host_list, script, auto, yaml, ini, toml Do you really need all these plugins? If not, they'll just add time to your processing. There is also a small chance that one of them is successfully parsing your inventory file as an empty inventory. And the documentation states that Once an ...


2

This can be done by judicious use of one of the Ansible callback plugins. Set the relevant configuration in your ansible.cfg file. You have a few options... In order to print nothing to the screen, you can use the null callback: This callback prevents outputing events to screen However, this may be overkill and doesn't do what you want, which is to ...


1

It sounds like you need to gather facts again once you've updated the inventory. You start off with First I add new host to my hosts.ini file However, Ansible is not notified about this until you tell it that the inventory has changed. If this is done during a play, you should use the add_host module: - name: Add host gluster1 to group gluster ...


1

As per the link, You can add keys via metadata. You can try the following. metadata: ssh-keys: "[USERNAME]:ssh-rsa [NEW_KEY_VALUE] [USERNAME]" Replace [USERNAME] & [NEW_KEY_VALUE] with actual key value.


1

any with_* is actully a local lookup. So as Zeitounator mentioned, you're going to need to use something like the find module to fetch the files you want. so I imagine that something like this would work: - hosts: primary remote_user: root tasks: - name: gather list of files to fetch find: paths: "/data1/" recurse: no ...


1

with_fileglog creates a loop with the fileglob lookup. As all other lookups it runs on the controller machine, not on the remote server. Since I guess you don't already have those backup files on the controller in the path you referenced, your loop is empty. As you have guessed, this approach will not work for your scenario. I suggest you have a look at ...


1

You can use Ansible’s template module transfers templated files to remote hosts. It works similarly to the copy module, but with major difference: You can use the jinja2 templating language in your files, which will be templated out separately for each remote host and you can have conditional statements, loops, filters for transforming the data, do ...


1

Copy module should work - hosts: all tasks: - copy: src: /data/new_config dest: /opt/zservice/etc/config owner: root group: wheel mode: '0750' backup: yes If you worry about the number of the hosts take a look at serial.


1

See my answer here: Ran into this today when trying to use Garden.io for a cluster running in Jelastic. Found the solution in this Github comment: First acquire a local binary for Tiller (server-version of Helm), either by compiling or by downloading it from the release page. Then run: $ export HELM_HOST=":44134" $ tiller -listen ${...


1

Oh! I have search for a while, it's should be like: docker run -d --name=ak_registry --restart=always -p 7900:5000 -v /data/.docker:/var/lib/registry registry Used /var/lib/registry instead of /tmp/registry


1

You have two mistakes: name as parameter of file module. It is an alias of path, so you actually try to create directory add dir. Unnecessary single quotes in path, giving you actual paths like etc/ansible/roles/webservers/'handlers'. Try with: ... - name: add dir file: path: '/etc/ansible/roles/webservers/{{ item }}' ...


1

I suggest that you do not reinvent the wheel and use a ansible galaxy role that has already solved the issues you are reporting. One could use Geerlingguys git role to install the latest git on CentOS7. It is possible to install this by issuing ansible-galaxy install geerlingguy.git and subsequently include geerlingguy.git in the roles in order to apply the ...


Only top voted, non community-wiki answers of a minimum length are eligible