ansible-2.x

Ansible stops connecting to the host via ssh [closed]

微笑、不失礼 提交于 2020-07-07 03:27:32
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question Introduction For over a month I've been running the following command: ansible-playbook -vvvvi host_test rhel-tests.yml Which connected via SSH and ran tests on a host successfully without any problems. But as of the last couple days, I've received the following

Ansible stops connecting to the host via ssh [closed]

天大地大妈咪最大 提交于 2020-07-07 03:27:20
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question Introduction For over a month I've been running the following command: ansible-playbook -vvvvi host_test rhel-tests.yml Which connected via SSH and ran tests on a host successfully without any problems. But as of the last couple days, I've received the following

Ansible 2.1.0 using become/become_user fails to set permissions on temp file

雨燕双飞 提交于 2020-06-24 05:43:12
问题 I have an ansible 2.1.0 on my server, where I do deployment via vagrant and on PC too. The role "deploy" have : - name: upload code become: true become_user: www-data git: repo=git@bitbucket.org:****.git dest=/var/www/main key_file=/var/www/.ssh/id_rsa accept_hostkey=true update=yes force=yes register: fresh_code notify: restart php-fpm tags: fresh_code In this case with ansible 2.1.0 I get an error: fatal: [default]: FAILED! => {"failed": true, "msg": "Failed to set permissions on the

Ansible 2.1.0 using become/become_user fails to set permissions on temp file

时光总嘲笑我的痴心妄想 提交于 2020-06-24 05:43:11
问题 I have an ansible 2.1.0 on my server, where I do deployment via vagrant and on PC too. The role "deploy" have : - name: upload code become: true become_user: www-data git: repo=git@bitbucket.org:****.git dest=/var/www/main key_file=/var/www/.ssh/id_rsa accept_hostkey=true update=yes force=yes register: fresh_code notify: restart php-fpm tags: fresh_code In this case with ansible 2.1.0 I get an error: fatal: [default]: FAILED! => {"failed": true, "msg": "Failed to set permissions on the

How to kill a running process using ansible?

百般思念 提交于 2020-06-09 09:43:33
问题 I have an ansible playbook to kill running processes and works great most of the time!, however, from time to time we find processes that just can't be killed so, "wait_for" gets to the timeout, throws an error and it stops the process. The current workaround is to manually go into the box, use "kill -9" and run the ansible playbook again so I was wondering if there is any way to handle this scenario from ansible itself?, I mean, I don't want to use kill -9 from the beginning but I maybe a

How to kill a running process using ansible?

為{幸葍}努か 提交于 2020-06-09 09:43:19
问题 I have an ansible playbook to kill running processes and works great most of the time!, however, from time to time we find processes that just can't be killed so, "wait_for" gets to the timeout, throws an error and it stops the process. The current workaround is to manually go into the box, use "kill -9" and run the ansible playbook again so I was wondering if there is any way to handle this scenario from ansible itself?, I mean, I don't want to use kill -9 from the beginning but I maybe a

Fetch module returns “unable to calculate the checksum of the remote file” while running in Docker but works fine when not in Docker

梦想的初衷 提交于 2020-06-01 05:56:09
问题 Ansible playbook (copy_file.yml): - name: Copy this file over please hosts: all gather_facts: false tasks: - name: Get files from scanners running in each DC fetch: src: /tmp/file_to_copy dest: /tmp/local_place flat: yes fail_on_missing: yes validate_checksum: no Command : ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i inventory playbook/copy_file.yml It works when I run it. But when I dockerize it, it gives me the error : fatal: [remotehost.com]: FAILED! => {"changed": false, "file": "

Unable to get “exclude” option working with unarchive module

﹥>﹥吖頭↗ 提交于 2020-05-29 07:13:48
问题 I have a tar/gzip file I am extracting to a list of hosts using the ansible unarchive module. The following is a partial list of the contents of configs.tgz: -rw-rw-r-- ian/ian 1295 2015-09-25 15:27 Makefile -rw-rw-r-- ian/ian 16 2016-06-21 09:24 .configs drwxrwxr-x ian/ian 0 2016-02-24 10:18 .bash/ -rw-rw-r-- ian/ian 336 2015-09-25 15:27 .bash/apt.b -rw-rw-r-- ian/ian 367 2015-09-25 15:27 .bash/gcloud.b drwxrwxr-x ian/ian 0 2016-06-21 09:22 .vim/ drwxrwxr-x ian/ian 0 2016-06-21 09:22 .vim

Ansible Python API: how to pass extra vars to playbook

◇◆丶佛笑我妖孽 提交于 2020-05-15 05:34:07
问题 I'm trying to use Python API to run some playbooks because I want to integrate it with Flash to enable the web-base control. Here is my playbook( crondis.yaml ): - hosts: "{{app_name}}-server" tasks: - name: disable cron cron: name: "{{app_name|upper}}_MONITOR" job: "/{{app_name}}/monitor.sh" disabled: yes From cml that can be this way: ansible-playbook --extra-vars="{'app_name': 'newapp'}" crondis.yaml But in the Python API, I'm not seeing any place to add the vars to the play. I checked

Difference between become and become_user in Ansible

我是研究僧i 提交于 2020-05-09 17:47:23
问题 Recently I started digging into Ansible and writing my own playbooks. However, I have a troubles with understanding difference between become and become_user . As I understand it become_user is something similar to su <username> , and become means something like sudo su or "perform all commands as a sudo user". But sometimes these two directives are mixed. Could you explain the correct meaning of them? 回答1: become_user defines the user which is being used for privilege escalation. become