ansible

I want to create jenkins credentials via ansible

元气小坏坏 提交于 2020-06-27 10:07:08
问题 I am putting together a developer machine using ansible. In that machine i am installing jenkins. I have created the jobs for jenkins with ansible: - shell: "java -jar {{ jenkins.cli_jar }} -s {{ jenkins.server }} create-job \ {{ item.name }} < {{ jenkins.jobs_dir }}/{{ item.xml_file }}" with_items: "jenkins.jobs" And installed the plugins, via cli etc. But now i am missing the ssh credentials for the jobs; i just want a ssh credential with user "jenkins" and that uses "From the Jenkins

Jinja2: format + join the items of a list

主宰稳场 提交于 2020-06-24 20:32:12
问题 play_hosts is a list of all machines for a play. I want to take these and use something like format() to rewrite them like rabbitmq@%s and then join them together with something like join() . So: {{ play_hosts|format(???)|join(', ') }} All the examples of format use piping where the input is the format string and not a list. Is there a way to use these (or something else) to accomplish what I want? The output should looks something like: ['rabbitmq@server1', 'rabbitmq@server2', rabbitmq

Jinja2: format + join the items of a list

生来就可爱ヽ(ⅴ<●) 提交于 2020-06-24 20:31:34
问题 play_hosts is a list of all machines for a play. I want to take these and use something like format() to rewrite them like rabbitmq@%s and then join them together with something like join() . So: {{ play_hosts|format(???)|join(', ') }} All the examples of format use piping where the input is the format string and not a list. Is there a way to use these (or something else) to accomplish what I want? The output should looks something like: ['rabbitmq@server1', 'rabbitmq@server2', rabbitmq

Jinja2: format + join the items of a list

ぃ、小莉子 提交于 2020-06-24 20:31:00
问题 play_hosts is a list of all machines for a play. I want to take these and use something like format() to rewrite them like rabbitmq@%s and then join them together with something like join() . So: {{ play_hosts|format(???)|join(', ') }} All the examples of format use piping where the input is the format string and not a list. Is there a way to use these (or something else) to accomplish what I want? The output should looks something like: ['rabbitmq@server1', 'rabbitmq@server2', rabbitmq

Jinja2: format + join the items of a list

做~自己de王妃 提交于 2020-06-24 20:30:38
问题 play_hosts is a list of all machines for a play. I want to take these and use something like format() to rewrite them like rabbitmq@%s and then join them together with something like join() . So: {{ play_hosts|format(???)|join(', ') }} All the examples of format use piping where the input is the format string and not a list. Is there a way to use these (or something else) to accomplish what I want? The output should looks something like: ['rabbitmq@server1', 'rabbitmq@server2', rabbitmq

Add a new key-value to a json file using Ansible

不问归期 提交于 2020-06-24 11:49:20
问题 I'm using Ansible to automate some configuration steps for my application VM, but having difficult to insert a new key-value to an existing json file on the remote host. Say I have this json file: { "foo": "bar" } And I want to insert a new key value pair to make the file become: { "foo": "bar", "hello": "world" } Since json format is not line based, I'm excluding lineinfile module from my options. Also, I would prefer not to use any external modules. Google keeps giving me examples to show

Append list variable to another list in Ansible

你。 提交于 2020-06-24 05:44:09
问题 is it possible to append a variable list to a static list in ansible? I can define the whole list as a variable: my_list: - 1 - 2 - 3 and then use it in a playbook as something: {{my_list}} But I cannot seem to find how to do this (pseudo code): list_to_append: - 3 - 4 and then in the playbook: something: - 1 - 2 - {{append: list_to_append}} If that is in fact impossible, what would you suggest for my use case? I have a list of items in a parameter, but some of them are optional and should be

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

Rundeck integration with Ansible through plugin

我的未来我决定 提交于 2020-06-23 18:08:19
问题 I am not able to configure the rundeck integration with ansible, I am using the rundeck-ansible plugin, but I am not getting easy and useful information/help from google. I have installed ansible and rundeck on the same server. I have used that plugin https://github.com/Batix/rundeck-ansible-plugin but not able to configure it. can anyone please share the link which h guide step by step. Any help will be appreciated. 回答1: Keep on mind that the Ansible plugin is out of the box with Rundeck,