Re: [ansible-project] The non-existence of local facts means Ansible cannot check the existence of a local fact
On 08.04.2019 21:40, nfwlpw wrote: I have a playbook that checks the existence of a local fact, but not every hosts have this local fact. On servers where it does not exist my playbook fails with: "msg": "The conditional check 'ansible_local['my_fact']['default']['name'] is defined' failed. The error was: error while evaluating conditional (ansible_local['my_fact']['default']['name'] is defined): 'dict object' has no attribute 'my_fact' This is quite annoying. I think I can work around it by checking the existence of the local fact file, but it feels like I'm missing something obvious. You need to use the default filter https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#defaulting-undefined-variables And you need to use the filter on every sub attribute. So something like this should work ((ansible_local['my_fact'] | default({}))['default'] | default({}))['name'] | default({}) -- Kai Stian Olstad -- 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+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/990710d3f20d9fdf9cd9940ea88eb610%40olstad.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] help me - error: Filespec must match the canonical format: [[namespace/]pod:]file/path
Hello All, Need your help on below issue. I am trying to run kubernetes command on a remote host using ansible. This command works when directly run on a remote host. ==> kubectl cp /etc/passwd bus-service/ssh-jumphost-6954f877bf-p5fmq:/etc/passwd_test But when using ansible - name: Copy commands shell: "kubectl cp {{ item }} baas-service/{{ jumphost.stdout_lines }}:{{ item }}" with_items: - { '/etc/master.passwd' } - { '/etc/passwd' } - { '/etc/group' } I get an error. failed: [gngqnc014c] (item={u'/etc/master.passwd': None}) => { "changed": true, "cmd": "kubectl cp {u'/etc/master.passwd': None}bus-service/[u'ssh-jumphost-6954f877bf-p5fmq', u'ssh-jumphost-6954f877bf-twg7j', u'ssh-jumphost-6954f877bf-xrmhs']:{u'/etc/master.passwd': None}", "delta": "0:00:00.070410", "end": "2019-04-08 16:04:49.551694", "invocation": { "module_args": { "_raw_params": "kubectl cp {u'/etc/master.passwd': None}bus-service/[u'ssh-jumphost-6954f877bf-p5fmq', u'ssh-jumphost-6954f877bf-twg7j', u'ssh-jumphost-6954f877bf-xrmhs']:{u'/etc/master.passwd': None}", "_uses_shell": true, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "warn": true } }, "item": { "/etc/master.passwd": null }, "msg": "non-zero return code", "rc": 1, "start": "2019-04-08 16:04:49.481284", "stderr": "error: Filespec must match the canonical format: [[namespace/]pod:]file/path", "stderr_lines": [ "error: Filespec must match the canonical format: [[namespace/]pod:]file/path" ], "stdout": "", "stdout_lines": [] } Can anyone help me on this issue? 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+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/09110715-1ca6-4223-93f5-13691c03550b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] RDS DB instance and EC2 security group are in different VPCs
I am trying to create an RDS MySQL instance in AWS using the Ansible rds module. It works fine if I do not provide subnet or SG parameters. it will deploys into the default VPC. However I need to be able to define the VPC for the instance to install into. It seams that the rds module does not suport a "vpc_id" parameter. it has got "subnet" and "vpc_security_groups" parameters, but when I specify values for those I get "msg": "Failed to create instance: The DB instance and EC2 [security group | subnet] are in different VPCs. The DB instance is in vpc- and the EC2 [security group | subnet] is in vpc-" Is the rds module only capable of deploying to the default VPC? Example play: - name: Create RDS MySQL rds: command: create instance_name: mydb db_engine: MySQL size: 10 instance_type: db.t2.micro publicly_accessible: no # vpc_id: "{{ vpc.id }}" (Parameter does not exist error) # subnet: "{{ subnet.id }}" (in different VPCs error) # vpc_security_groups: "{{ sg.id }}" (in different VPCs error) region: "{{ ec2_region }}" username: admin password: xyz123 I have tried making modifications to use "rds_instance" instead of "rds" module. I ended up in the same place. The play will create an instance in the default VPC but I don't know how to create the instance in the target VPC, so that the instance will connects to the correct subset and SG. Is this a bug? Should I log it to the Ansible project? Error: "EC2 security group are in different VPCs. The DB instance is in vpc- and the EC2 security group is in vpc-" - name: Create RDS MySQL #rds rds_instance: # command: create # instance_name: mydb db_name: mydb db_instance_identifier: mydb # db_engine: MySQL engine: MySQL # size: 10 allocated_storage: 10 instance_type: db.t2.micro publicly_accessible: no # db_subnet_groups vpc_id: "{{ vpc.id }}" # subnet: "{{ subnet.id }}" # vpc_security_groups: "{{ sgid }}" vpc_security_group_ids: "{{ sgid }}" region: "{{ ec2_region }}" username: admin password: xyz123 tags: Environment: testing Application: cms -- 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+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5b0afdbb-de33-4e39-ae8d-b4f988290665%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Re: Ansible issue with Windows and Chocolatey 0.10.13
Not something I've tested but if you are installing it from the public repo and not some internal repository you might be able to set the 'chocolateyVersion' environment variable as documented by https://chocolatey.org/install#installing-a-particular-version-of-chocolatey. This can be done with; - win_chocolatey: name: chocolatey state: present environment: chocolateyVersion: '0.10.11' This isn't something I've tested to prove it works so you would just have to try it and see how it goes. The alternative option is to use an internal repo and don't add the latest Chocolatey version nupkg and source it from there. Thanks Jordan -- 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+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/14a5925e-5f00-4612-95da-a5d21abff968%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] The non-existence of local facts means Ansible cannot check the existence of a local fact
I have a playbook that checks the existence of a local fact, but not every hosts have this local fact. On servers where it does not exist my playbook fails with: "msg": "The conditional check 'ansible_local['my_fact']['default']['name'] is defined' failed. The error was: error while evaluating conditional (ansible_local['my_fact']['default']['name'] is defined): 'dict object' has no attribute 'my_fact' This is quite annoying. I think I can work around it by checking the existence of the local fact file, but it feels like I'm missing something obvious. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d95034cd-e1b0-4ab6-91ba-58ce0aca5d61%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Re: Ansible issue with Windows and Chocolatey 0.10.13
Jordan, Is it possible in a configuration file to specify the version of chocolatey to install? Thanks Jason On Monday, March 25, 2019 at 3:12:17 PM UTC-5, Jordan Borean wrote: > > This is a known issue and is due to a breaking change on Chocolatey's end > in the 0.10.12 release. See > https://github.com/ansible/ansible/issues/53860#issuecomment-473431360 > for more details. > > Thanks > > Jordan > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d4ce752d-ecaf-4720-9016-ef1aa2bff979%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Re: Variable substitution in meta/main.yml
Nobody has any input on this? -- 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+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e5ede072-d7db-4680-bfce-9b554a52dcb8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] Execut playbook host after host
Hi Sebastian Meyer, You are the best !! I do not know this module of Ansible "serial: 1" Thank you very much !! ;) I wish you a good day :) Regards, Le lundi 8 avril 2019 11:47:03 UTC+2, Sebastian Meyer a écrit : > > On 08.04.19 11:40, ryad9...@gmail.com wrote: > > I want that when i run my task, ansible execute only on my_host_1 > > and when ansible fish execut task, he execut in second host of my > inventory > > "my_host_2" > > > > Someone have an idea please ? > > > https://docs.ansible.com/ansible/latest/user_guide/playbooks_delegation.html#rolling-update-batch-size > > > Use `serial: 1` > > HTH, > Sebastian > > -- > Sebastian Meyer > Linux Consultant & Trainer > Mail: me...@b1-systems.de > > B1 Systems GmbH > Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de > GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2e18013d-21ef-473a-9010-6bcc5a1e3bf0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] Execut playbook host after host
On 08.04.19 11:40, ryad9200...@gmail.com wrote: > I want that when i run my task, ansible execute only on my_host_1 > and when ansible fish execut task, he execut in second host of my inventory > "my_host_2" > > Someone have an idea please ? https://docs.ansible.com/ansible/latest/user_guide/playbooks_delegation.html#rolling-update-batch-size Use `serial: 1` HTH, Sebastian -- Sebastian Meyer Linux Consultant & Trainer Mail: me...@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537 -- 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+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c4744dbe-a332-7c6f-fcad-4c0906e94e5e%40b1-systems.de. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Execut playbook host after host
Hi all, I have my principal playbook with this content : - hosts: all become: no gather_facts: no roles: - role I have on file with content : my_host_1 ansible_user: my_user my_host_2 ansible_user: my_user I want that when i run my task, ansible execute only on my_host_1 and when ansible fish execut task, he execut in second host of my inventory "my_host_2" Someone have an idea please ? Thanks community Ansible !!! ;) Regards, -- 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+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0cd01c6d-7bfd-4075-8dd3-2e559489ec59%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.