Re: [ansible-project] how to get the host in groups children?

2021-01-20 Thread Jean-Yves LENHOF
Hi, 1/ Sounds like you use a lot the when clause to limit the impact of action to some servers. Why you did'nt use more the hosts clause to handle the action on specific hosts ? You can have more than one hosts clause in a playbook Notice that you can reuse variable in a previous play in

[ansible-project] how to get the host in groups children?

2021-01-20 Thread liyo...@126.com
my inventroy file is below: [master] 172.24.64.44 172.24.64.42 172.24.64.43 [worker] 172.24.64.46 [cluster:children] master worker I want to exec the playbook in [cluster:children]'s master 172.24.64.44,want to get the variables value ,then use it in other group ,how to write the "when" ? pleas

Re: [ansible-project] How to handle multi-host roles?

2021-01-20 Thread Vladimir Botka
On Wed, 20 Jan 2021 19:18:40 -0700 Rich Megginson wrote: > >shell> cat hosts > >hosta vpn=enabled > >hostb vpn=disabled > >hostc vpn=enabled > > > > The playbook > > > >- hosts: all > > gather_facts: false > > tasks: > >- add_host: > >groups: vp

Re: [ansible-project] How to handle multi-host roles?

2021-01-20 Thread Rich Megginson
On 1/20/21 6:16 PM, Vladimir Botka wrote: On Wed, 20 Jan 2021 15:45:00 -0700 Rich Megginson wrote: - hosts: some_arbitrary_name_of_my_group_of_vpn_hosts  roles:    - linux-system-roles.vpn or you can specify the hosts manually: - hosts: hosta,hostb,hostc roles:   - linux-system-rol

Re: [ansible-project] How to handle multi-host roles?

2021-01-20 Thread Rich Megginson
On 1/20/21 6:40 PM, Vladimir Botka wrote: On Wed, 20 Jan 2021 15:45:00 -0700 Rich Megginson wrote: The use case is that e.g. some sort of per-host key could be defined as a host fact, and if the role is running on host b, and it needs to set up a tunnel with host a, it can look up the key in t

Re: [ansible-project] How to handle multi-host roles?

2021-01-20 Thread Vladimir Botka
On Wed, 20 Jan 2021 15:45:00 -0700 Rich Megginson wrote: > The use case is that e.g. some sort of per-host key could be defined as > a host fact, and if the role is running on host b, and it needs to set > up a tunnel with host a, it can look up the key in the host facts for > host a. > > Of

Re: [ansible-project] How to handle multi-host roles?

2021-01-20 Thread Vladimir Botka
On Wed, 20 Jan 2021 15:45:00 -0700 Rich Megginson wrote: > - hosts: some_arbitrary_name_of_my_group_of_vpn_hosts >  roles: >    - linux-system-roles.vpn > > or you can specify the hosts manually: > > - hosts: hosta,hostb,hostc > roles: >   - linux-system-roles.vpn > > or some combination

Re: [ansible-project] How to handle multi-host roles?

2021-01-20 Thread Rich Megginson
On 1/20/21 3:26 PM, Matt Martz wrote: Typically speaking, I tell people that roles should never know about your environment. Instead anything that your role needs to know about should be passed in. As such, I would avoid needing a special group to exist in your inventory, but instead maybe pa

Re: [ansible-project] How to handle multi-host roles?

2021-01-20 Thread Matt Martz
Typically speaking, I tell people that roles should never know about your environment. Instead anything that your role needs to know about should be passed in. As such, I would avoid needing a special group to exist in your inventory, but instead maybe passing that in. If they need to know host f

[ansible-project] How to handle multi-host roles?

2021-01-20 Thread Rich Megginson
I am unfamiliar with how administrators structure their inventories and playbooks with respect to roles that run against multiple hosts as a group.  We have two new system roles - vpn https://github.com/linux-system-roles/vpn and ha_cluster https://github.com/linux-system-roles/ha_cluster - tha

Re: [ansible-project] Process/Governance

2021-01-20 Thread Stephen John Smoogen
On Wed, 20 Jan 2021 at 13:47, Keith Mills wrote: > Hi Smooge, > > I guess I want to say Governance around Development and Deployment of > Ansible playbooks. Does this make more sense? > > It is still fuzzy. Pretty much every site I know follows some governance system which is 'site local' which p

Re: [ansible-project] Process/Governance

2021-01-20 Thread Keith Mills
Hi Smooge, I guess I want to say Governance around Development and Deployment of Ansible playbooks. Does this make more sense? On Wednesday, January 20, 2021 at 8:55:46 AM UTC-6 Smooge wrote: > On Wed, 20 Jan 2021 at 09:47, Keith Mills wrote: > >> Hello All, >> >> Would someone please explain

Re: [ansible-project] TASK [archive the files] fatal: : FAILED! => {"msg": "'dict object' has no attribute 'files'"}

2021-01-20 Thread Nithin Subbaraj
Thanks for the help ,our main aim is to create a automated ansible script which takes multiple path (hard coded) and with find module it should check files older than 7 days and should exclude few directories or files and should compress the other files. But somehow find and exclude path with ti

Re: [ansible-project] TASK [archive the files] fatal: : FAILED! => {"msg": "'dict object' has no attribute 'files'"}

2021-01-20 Thread Stefan Hornburg (Racke)
On 1/20/21 4:31 PM, Nithin Subbaraj wrote: > Hi Team, > > I am trying to create an ansible script which excludes a particular directory > and its contents > and should zip the files under other directories but getting the below error > > TASK [archive the files] fatal: : FAILED! => {"msg": "'dic

[ansible-project] TASK [archive the files] fatal: : FAILED! => {"msg": "'dict object' has no attribute 'files'"}

2021-01-20 Thread Nithin Subbaraj
Hi Team, I am trying to create an ansible script which excludes a particular directory and its contents and should zip the files under other directories but getting the below error TASK [archive the files] fatal: : FAILED! => {"msg": "'dict object' has no attribute 'files'"} my script ##

Re: [ansible-project] Process/Governance

2021-01-20 Thread Stephen John Smoogen
On Wed, 20 Jan 2021 at 09:47, Keith Mills wrote: > Hello All, > > Would someone please explain Ansible process/governance around playbooks. > > I think you would need to explain in a bit of detail what you mean by process/governance because that has a similar but different definitions in configur

[ansible-project] Process/Governance

2021-01-20 Thread Keith Mills
Hello All, Would someone please explain Ansible process/governance around playbooks. Thanks -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project

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

2021-01-20 Thread Oliver Schiinke
Thank you very much! I did not know about that package. Em quarta-feira, 20 de janeiro de 2021 às 03:09:35 UTC-3, dick@geant.org escreveu: > 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 W

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

2021-01-20 Thread liyo...@126.com
it works,thanks very mush 在2021年1月20日星期三 UTC+8 下午4:21:04 写道: > thanks,I try it : > shell: kubeadm join --control-plane {{ groups['master'][0] }}:6443 --token > {{ hostvars[groups['master']|first]['kubeadm_token'].stdout }} > --discovery-token-ca-cert-hash sha256:{{ > hostvars[groups['master']

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

2021-01-20 Thread liyo...@126.com
thanks,I try it : shell: kubeadm join --control-plane {{ groups['master'][0] }}:6443 --token {{ hostvars[groups['master']|first]['kubeadm_token'].stdout }} --discovery-token-ca-cert-hash sha256:{{ hostvars[groups['master']|first]['kubeadm_hash'].stdout }} but the ansible-playbook command is sei

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

2021-01-20 Thread Jean-Yves LENHOF
You could try something hostvars[groups['master']|first] instead of hostvars['master'] in my proposition to see it that works...not sure Use a debug module could help Regards, JYL Le 20/01/2021 à 08:53, liyo...@126.com a écrit : yes,I want only get one host in member of group ‘master’,how 

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

2021-01-20 Thread liyo...@126.com
I just try to use set_fact,but only one one host: 47.108.234.26 get the token value,the other master node : 47.108.213.148 dont get it --- - hosts: master gather_facts: no tasks: - name: register hash shell: "openssl x509 -in /etc/kubernetes/pki/ca.crt -noout -pubkey | openssl r