ansible

How to append the file using Ansible

我的未来我决定 提交于 2019-12-25 18:50:59
问题 I'm trying to append a file to the existing file. When I hit a specific url I get the updated data everytime. my requirement is to append the updated to the same file instead of creating a new file everytime. I'm using get_url module to get the file. but the file is not being updated. If I give the destination as new file then data is being copied to new file. 回答1: get_url doesn't appear to support that operation. You may need to retrieve the file and use the Assemble module to concatenate

How to append the file using Ansible

我的未来我决定 提交于 2019-12-25 18:50:05
问题 I'm trying to append a file to the existing file. When I hit a specific url I get the updated data everytime. my requirement is to append the updated to the same file instead of creating a new file everytime. I'm using get_url module to get the file. but the file is not being updated. If I give the destination as new file then data is being copied to new file. 回答1: get_url doesn't appear to support that operation. You may need to retrieve the file and use the Assemble module to concatenate

ntc-ansible “response” and “module_args” (how access?)

限于喜欢 提交于 2019-12-25 18:43:57
问题 I am using the networktocode ntc-ansible module in Ansible to control Cisco IOS devices (switches currently). I successfully can use ntc_show_Command to get 'show version' and 'show ip int brief' and put the result into a local file. But when I use the -vvv at the end of the ansible-playbook command, I see structured JSON output in the terminal. How do I get a access the "module_args" and the "response" from the ntc_show_command, ie. if i use "show ip int brief" and i want to know the status

default ansible template returns error

我怕爱的太早我们不能终老 提交于 2019-12-25 17:44:43
问题 do Ansible in default configuration works with other vendors? For example Huawei ? If i'm running some testing commands like: sudo ansible -m shell -a 'display version' servers 10.46.1.1 | UNREACHABLE! => { "changed": false, "msg": "Failed to connect to the host via ssh: \r\n**********************************************************************\r\n* Jus esate prisijunge prie privacios irangos. Visi veiksmai,vykdomi *\r\n* su sia iranga, yra fiksuojami. Tam, kad prieiti prie sios irangos *\r\n

Ansible with subelements referencing a dict

自作多情 提交于 2019-12-25 11:13:29
问题 Bear with me, please. I've never had to do something this complex with Ansible and I'm really struggling to piece it together. To sum it up, I already have a dict and a task to deploy our employee's SSH accounts and public keys to our servers. I would like to re-use this dict to also deploy certain employee keys to certain website user accounts. An example probably explains better than I can. employee_ssh_users: user1: 'user1key' user2: 'user2key' user3: 'user3key' user4: 'user4key' - name:

Ansible playbook: Requires sudo password [duplicate]

僤鯓⒐⒋嵵緔 提交于 2019-12-25 09:42:34
问题 This question already has an answer here : How can a user with SSH keys authentication have sudo powers in Ansible? [duplicate] (1 answer) Closed last year . I am currently working with ansible and I want to automate dumping of my Remote DB and import the dumped file to my local DB. Now, I encountered some problem for using sudo to switch user. playbook.yml --- - hosts: remoteserver vars: remote_db_name: dbname remote_filename: dbname_{{ lookup('pipe', 'date +%m-%d-%Y') }} local_folder: /home

Can a value in a variable and a string with backslashes be combined in ansible?

你说的曾经没有我的故事 提交于 2019-12-25 09:09:00
问题 I have an ansible playbook in which one variable I am passing from the command. I am trying to append a windows folder path to it. One way I am able to find out is to add the path to another variable and then join the two variable. I would like to know if it is possible to avoid the variable and put the path like this: "{{ variable2 }} \build\dist\package\ui.msi" variable1 has value "d:\install" var_build_file_name is entered by the user variable2 is formed by combining variable1 and var

Ansible playbook looping control flow

↘锁芯ラ 提交于 2019-12-25 09:00:03
问题 I have a playbook that checks the list of installed plugins for 6 jenkins servers. Here is the hostfile: [masters] server1 server2 server3 server4 server5 server6 Here is the task within the playbook that handles obtaining the list of installed plugins: - name: Obtaining a list of Jenkins Plugins jenkins_script: script: 'println(Jenkins.instance.pluginManager.plugins)' url: "{{ item }}" user: 'admin' password: 'password' with_items: - 'url1' - 'url2' - 'url3' - 'url4' - 'url5' - 'url6' This

dopy.manager.DoError: Unable to authenticate you

喜你入骨 提交于 2019-12-25 07:59:52
问题 I'm trying to configure a Virtual Machine(with Vagrant and Ansible), that needs a file.py to the full correct configuration of this machine (according to the book that I'm studying),I'm was using the DigitalOcean API V2, but as I have no a valid credit card my account is bloked,so I had to change DigitalOcean to AWS,as the company where I work have an account with AWS,now I take the 'client id' and 'api key' from AWS VM,so the foregoing problems returned...when I try use the "python file.py"

Run ansible on specific hosts group

你说的曾经没有我的故事 提交于 2019-12-25 07:49:46
问题 I am trying to run ansible with the following command, ansible-playbook provision.yml -l webserver And my hosts file contains the following host groups, [webclient] 172.29.4.75 [webserver] 172.29.4.76 My provision.yml also contains 2 hosts as below, - hosts: webclient user: centos roles: - nginx - nvm - hosts: webserver user: centos roles: - tomcat My issue here is even thought I use "-l webserver" roles specified for webclient also runs in webclient hosts. How can I control it to run only