Re: [ansible-project] register variable can't be used in shell module?

2021-01-19 Thread liyo...@126.com
yes,I want only get one host in member of group ‘master’,how to write it ? [root@localhost ~]# cat /etc/ansible/hosts [master] 47.108.222.84 47.108.234.26 47.108.213.148 only use "47.108.222.84" to do shell command 在2021年1月20日星期三 UTC+8 下午3:47:31 写道: > I'm wrong it's not

Re: [ansible-project] register variable can't be used in shell module?

2021-01-19 Thread Jean-Yves LENHOF
I'm wrong it's not hostvars['master'], because master is not the name of your first host in group master Le 20/01/2021 à 08:33, Jean-Yves LENHOF a écrit : You're looking for something like this I think (not tested) :     - name: add master node       shell: "kubeadm join {{

Re: [ansible-project] register variable can't be used in shell module?

2021-01-19 Thread Jean-Yves LENHOF
You're looking for something like this I think (not tested)  :     - name: add master node       shell: "kubeadm join {{ groups['master']|first }}:6443 --token {{hostvars['master']['kubeadm_token'].stdout}} --discovery-token-ca-cert-hash sha256:{{hostvars['master']['kubeadm_hash'].stdout}}

Re: [ansible-project] register variable can't be used in shell module?

2021-01-19 Thread Dick Visser
You could register the variable to a dummy host. It's a bit of a hack imho but it does work. https://stackoverflow.com/questions/33896847/how-do-i-set-register-a-variable-to-persist-between-plays-in-ansible On Wed, 20 Jan 2021 at 08:17, liyo...@126.com wrote: > I know,but I want get the token

Re: [ansible-project] register variable can't be used in shell module?

2021-01-19 Thread liyo...@126.com
I know,but I want get the token in A host,use it in other hosts,how to do it ? 在2021年1月20日星期三 UTC+8 下午2:31:36 写道: > Hii > > You're registering a variable for one host (47.108.222.84) but then try to > use it for another (47.108.213.148). > > I'm have no experience with kubeadm but I think your

Re: [ansible-project] register variable can't be used in shell module?

2021-01-19 Thread Dick Visser
Hii You're registering a variable for one host (47.108.222.84) but then try to use it for another (47.108.213.148). I'm have no experience with kubeadm but I think your logic wrt host selection should be improved, so that you can reliably pick the variable from a stable group name, instead of

Re: [ansible-project] very simple ad-hoc command returning an error

2021-01-19 Thread Dick Visser
The ansible part is ok, but your target host does not know about an 'ntp' package. IIRC centos/rhel now use 'chrony' for time keeping. On Wed, 20 Jan 2021 at 03:44, Oliver Schiinke wrote: > Hello, > > I'm trying to run this ad-hoc command to install ntp package in a specific > server: > >

[ansible-project] register variable can't be used in shell module?

2021-01-19 Thread liyo...@126.com
when I edit a playbook test.yml: --- - hosts: master gather_facts: no tasks: - name: register hash shell: "openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^ .* //'|cut -d' ' -f 2"

[ansible-project] Need permissions changed of folder + files together using Ansible synchronize module

2021-01-19 Thread shif...@gmail.com
Unable to default omit when synchronize attributes are multiline in Ansible Below Ansible works fine when final_file_perm is defined: - name: Copying from "{{

[ansible-project] very simple ad-hoc command returning an error

2021-01-19 Thread Oliver Schiinke
Hello, I'm trying to run this ad-hoc command to install ntp package in a specific server: ansible db -b -m yum -a "name=ntp state=present" But I'm getting this error: | FAILED! => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false,

[ansible-project] Re: ansible Jira comment issue

2021-01-19 Thread Ramesh AR
Does anyone know why the below syntax is commenting same output repeating twice in Jira comment section . - local_action: lineinfile line="CIMC IP is {{ inventory_hostname.split() | list | to_yaml }} {{ user | rejectattr('accountStatus', 'eq', 'inactive')| list | to_yaml }}"

Re: [ansible-project] Re: ansible error

2021-01-19 Thread Dick Visser
what does ports_dhcpd01 evaluate to? On Tue, 19 Jan 2021 at 21:17, Andrew Meyer wrote: > Here is the section this is referring too: > # tasks file for setup_dhcpd > - name: Update Firewall Rules dhcp01 > firewalld: > port: "{{ ports_dhcpd01 }}" > permanent: true > state: enabled >

[ansible-project] ansible Jira

2021-01-19 Thread Ramesh AR
Hello all, The below is the debug output and host1 is 1st comment and host 2 is 2nd comment so on .. how to combine these two debug o/p and comment into one section. debug output ++ ok: [host1] => {} MSG: - {accountStatus: active, id: '1', name: admin, priv:

[ansible-project] Re: ansible error

2021-01-19 Thread Andrew Meyer
Here is the section this is referring too: # tasks file for setup_dhcpd - name: Update Firewall Rules dhcp01 firewalld: port: "{{ ports_dhcpd01 }}" permanent: true state: enabled immediate: yes zone: public become: true On Tuesday, January 19, 2021 at 2:15:58 PM UTC-6

[ansible-project] ansible error

2021-01-19 Thread Andrew Meyer
Hello, I am trying to run my ansible playbook but am getting the following error running ansible ``` ansible-2.9.16-1.el8.noarch ansible-doc-2.9.16-1.el8.noarch ansible-freeipa-0.1.12-6.el8.noarch ``` ``` The full traceback is: Traceback (most recent call last): File

Re: [ansible-project] Ansible Playbook Issue

2021-01-19 Thread Dick Visser
On Tue, 19 Jan 2021 at 19:32, Prasath Sekar wrote: > I have a ansible playbook file to create a digitalocean droplet. > > While running the playbook i am getting the issue > > "dopy >= 0.3.2 required for this module" > > But I have already installed dopy 0.3.5 > > What would be the issue > The

[ansible-project] Ansible Playbook Issue

2021-01-19 Thread Prasath Sekar
I have a ansible playbook file to create a digitalocean droplet. While running the playbook i am getting the issue "dopy >= 0.3.2 required for this module" But I have already installed dopy 0.3.5 What would be the issue -- You received this message because you are subscribed to the Google

Re: [ansible-project] Determine last host in host list

2021-01-19 Thread Brian Coca
Consider that you have parallel execution so 'last host' might not be the last one executing (unless serial=1 or forks=1). -- -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

Re: [ansible-project] Determine last host in host list

2021-01-19 Thread 'Mark Tovey' via Ansible Project
Some good answers! Thanks! -Mark On Monday, January 18, 2021 at 3:17:32 PM UTC-8 flowerysong wrote: > On Monday, January 18, 2021 at 5:13:09 PM UTC-5 vbo...@gmail.com wrote: > >> On Mon, 18 Jan 2021 22:11:35 +0100 >> Vladimir Botka wrote: >> >> > On Mon, 18 Jan 2021 11:32:05 -0800

[ansible-project] Accessing playbook variables in external script

2021-01-19 Thread PluftPlayzRoblox
I am doing data validation of all the variables defined in ansible using a python script. How do you access ansible variables in the external python script? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and

Re: [ansible-project] Assert documentation and possibilities

2021-01-19 Thread PluftPlayzRoblox
Thanks Andrew and Vladimir. That’s very helpful. On Tue, Jan 19, 2021 at 10:13 AM Vladimir Botka wrote: > On Tue, 19 Jan 2021 06:20:17 -0800 (PST) > PluftPlayzRoblox wrote: > > > ... where can I find supported tests for assert? > > Use Ansible tests >

Re: [ansible-project] Assert documentation and possibilities

2021-01-19 Thread Vladimir Botka
On Tue, 19 Jan 2021 06:20:17 -0800 (PST) PluftPlayzRoblox wrote: > ... where can I find supported tests for assert? Use Ansible tests https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html and Jinja tests

Re: [ansible-project] Assert documentation and possibilities

2021-01-19 Thread Andrew Latham
It is documented at https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html and conditionals is the search term you wanted. On Tue, Jan 19, 2021 at 7:20 AM PluftPlayzRoblox wrote: > Sorry for newbie question but I cannot find any information on what can be > done with

[ansible-project] Assert documentation and possibilities

2021-01-19 Thread PluftPlayzRoblox
Sorry for newbie question but I cannot find any information on what can be done with assert. For example, going through ansible modules in galaxy, I found that you can do something like 'var is number' to test that var is integer and not string. Where can I found documentation on what can be