Re: [ansible-project] Problem by setting up Network Interface (Newbie)

2018-11-30 Thread Uwe Sauter
I think you don't understand the structure of "interfaces" > Here the output of the debug: > > ok: [server1.infra.sys] => { >     "interfaces": [ >         { >             "bootproto": "none", >             "device": "ens192", >             "gateway": "1.1.1.250", >    

Re: [ansible-project] Problem by setting up Network Interface (Newbie)

2018-11-30 Thread Uwe Sauter
s }}' in the available > lookup plugins"} > > > Am Freitag, 30. November 2018 08:54:22 UTC+1 schrieb Uwe Sauter: > > When I'm debugging Ansible Playbooks and I don't know if I can access a > variable I usually have a debug block. > > In your case this might look

Re: [ansible-project] Problem by setting up Network Interface (Newbie)

2018-11-29 Thread Uwe Sauter
When I'm debugging Ansible Playbooks and I don't know if I can access a variable I usually have a debug block. In your case this might look something like: # - debug: msg: ''{{ item | to_nice_yaml }}' loop: '{{ interfaces }}' - meta: end_play # Put this block in front of the

Re: [ansible-project] Accessing variables in yaml file

2018-11-29 Thread Uwe Sauter
ay, November 29, 2018 at 2:40:58 PM UTC-8, Uwe Sauter wrote: > > Look for group vars and put all servers in the same group in the > inventory file. > > Am 29.11.18 um 23:11 schrieb Andy: > > I am new to ansible. > > I create

Re: [ansible-project] Accessing variables in yaml file

2018-11-29 Thread Uwe Sauter
Look for group vars and put all servers in the same group in the inventory file. Am 29.11.18 um 23:11 schrieb Andy: I am new to ansible. I create a yaml file with multiple hosts defined --- -hosts: localhost   vars:   tasks: -hosts: webserver1  vars: same as localhost  tasks:

Re: [ansible-project] How do I exit Ansible playbook without error on a condition

2018-11-24 Thread Uwe Sauter
https://docs.ansible.com/ansible/2.7/modules/meta_module.html - meta: end_play when: condition is true Am 24.11.18 um 18:35 schrieb Kai Stian Olstad: On Saturday, 24 November 2018 18:19:26 CET Pandu jh wrote: I have 3 plays in a playbook. In a task in 1st play, If the desired value is

Re: [ansible-project] Re: how to get value from yaml file ?

2018-11-22 Thread Uwe Sauter
What version of Ansible? Are you sure the files are encoded in UTF-8? Am 23. November 2018 06:37:33 MEZ schrieb Eric Chang : >thanks for reply , I think my source file is yaml file >I can pass the yaml validator online > >here are 2 items in teams.yml > >"teams": [ >> {"chinese_name":

Re: [ansible-project] how to get value from yaml file ?

2018-11-22 Thread Uwe Sauter
Hi, your file looks like JSON to me, not like YAML (though one is a subset of the other, if I remember correctly…). My test: ### teams.yaml ### --- chinese_name: "\u8ca1\u52d9\u6703\u8a08\u8655" description: "\u8ca1\u52d9\u6703\u8a08\u8655" gid": 10126 location": - "hq" name: "ac" users: -

[ansible-project] use display_ok_hosts = no and debug module simultaneously

2018-11-17 Thread Uwe Sauter
Hi, currently with ansible.cfg containing [defaults] display_ok_hosts = no display_skipped_hosts = no stdout_callback = yaml no output is given when I use the debug module. This is obviously correct behavior because the debug task returns ok. But it makes debugging hard if you have a lot of

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Uwe Sauter
Ah, I missed that line. Thanks. Am 05.11.18 um 16:18 schrieb Kai Stian Olstad: > On Monday, 5 November 2018 16:06:19 CET Uwe Sauter wrote: >> As far as I can tell there is no such loop in the template: > > It is, i just formatted it to show it more clearly. > > >&

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Uwe Sauter
rror=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid >From which message did you get that loop in the template? Am 05.11.18 um 15:51 schrieb Kai Stian Olstad: > On Monday, 5 November 2018 15:38:51 CET Uwe Sauter wrote: >> Sure, but the template will only be used for the one

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Uwe Sauter
Sure, but the template will only be used for the one host and as such should not look for variables of other hosts, right? Am 05.11.18 um 15:18 schrieb Kai Stian Olstad: > On 05.11.2018 15:08, Uwe Sauter wrote: >> Because he was running the playbook with this commandline: >> >

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-05 Thread Uwe Sauter
Because he was running the playbook with this commandline: ansible-playbook -i infra --limit mysql04 main.yml --tags "mysql" -vvv Am 05.11.18 um 15:06 schrieb Kai Stian Olstad: > On 04.11.2018 23:50, Tom K. wrote: >> Hey Uwe, >> >> I hear you and apologies.  Was trying to keep it from getting

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-04 Thread Uwe Sauter
with -vvv. Am 04.11.18 um 16:25 schrieb Tom K.: On Sunday, November 4, 2018 at 10:20:56 AM UTC-5, Uwe Sauter wrote: Would you mind sending the complete output of ansible-playbook main.yaml -vvv ? I got a result now but need to continue this in a bit as I need to step away: | [root

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-04 Thread Uwe Sauter
Would you mind sending the complete output of ansible-playbook main.yaml -vvv ? Am 04.11.18 um 16:16 schrieb Tom K.: On Sunday, November 4, 2018 at 10:03:49 AM UTC-5, Uwe Sauter wrote: OK, more comments: > > So I've modified the first main.yml as f

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-04 Thread Uwe Sauter
OK, more comments: So I've modified the first main.yml as follows: | # cat main.yml --- -name:Gatherall facts prior to execution   hosts:mysql   gather_facts:false Not gathering facts here will lead you to miss many of the ansible_* variables.   tasks: -name:Dumpansible_default_ipv4

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-04 Thread Uwe Sauter
As the error message state, 'HostVarsVars' is an Python object. Without looking into the source code I suspect it to be some kind of Class inside the HostVars object that holds the actual values you can access via hostvars[inventory_hostname]["key"]. Am 04.11.18 um 15:28 schrieb Tom K.: On

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-04 Thread Uwe Sauter
Did you check /tmp on your mysql host? This will copy 'content' to the destination on the target host, not on the host running the playbook. Am 04.11.18 um 15:22 schrieb Tom K.: On Sunday, November 4, 2018 at 2:45:06 AM UTC-5, Uwe Sauter wrote: Hi, Am 04.11.18 um 00:45 schrieb

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-04 Thread Uwe Sauter
Hi, Am 04.11.18 um 00:45 schrieb Tom K.: Thanks Uwe! | # cat main.yml --- -name:Gatherall facts prior to execution   hosts:mysql   gather_facts:yes -name:Installandconfigure MySQL   hosts:mysql   sudo:yes   roles: -mysql   tags:mysql | First of all: you don't need the first play

Re: [ansible-project] {"changed": false, "msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars object' has no attribute 'ansible_default_ipv4'"}

2018-11-03 Thread Uwe Sauter
Could you show us the play where this happens? Am 03.11.18 um 21:18 schrieb Tom K.: Hey All, Receiving the following from Ansible 2.7 and not sure if I should be predefining a variable and pointing to this fact first or perhaps this is related to something else? (Relatively new to Ansible)

Re: [ansible-project] hostvars[some_ip] does not contain `ansible_hostname`

2018-11-03 Thread Uwe Sauter
In order to access some ansible_* variables you need to gather facts on the host before. See e.g. https://stackoverflow.com/questions/45908067/whats-the-difference-between-inventory-hostname-and-ansible-hostname Am 03.11.18 um 21:15 schrieb Barry Kaplan: Why would this be? It has lots and

Re: [ansible-project] Very first time Network Engineer user - ping module needs to connect with SSH to work?

2018-10-19 Thread Uwe Sauter
The ping module is not the classical ping command but an Ansible module that will connetc to the remote host via SSH and send back a "pong" if that succeeds. See the docs. If you want to use the classical ping command you need to use the "command" or "shell" module to call that from Ansible;

[ansible-project] increase local host performance for copy and template module

2018-10-04 Thread Uwe Sauter
Hi all, I'm having a performance issue with local execution of the copy and template modules that are put into task files. Both modules are used in with_nested loops where item[0] is about 100 elements and item[1] is about 6 elements long for copy and 10 elements long for template. Execution

Re: [ansible-project] [WARNING]: * Failed to parse /etc/ansible/hosts with ini plugin: /etc/ansible/hosts:5: Expected key=value, got: ansible_winrm_transport: basic

2018-09-10 Thread Uwe Sauter
ansible_winrm_transport: basic should be ansible_winrm_transport=basic Am 10.09.18 um 11:23 schrieb Victor Sava: > [all:vars] > ansible_connection=winrm > ansible_user=doomaine\jenkins > ansible_pass=asdasdasda > ansible_winrm_transport: basic > > > error :  > * Failed to parse

Re: [ansible-project] Output from "fail" too verbose

2018-08-24 Thread Uwe Sauter
Thanks, that worked. Though it feels unusual and a little like cheating Ansible. Regards, Uwe Am 24.08.18 um 10:17 schrieb Kai Stian Olstad: > On 24.08.2018 09:33, Uwe Sauter wrote: >> I have a list of files where I need to check existence and fail if one >> doesn't e

[ansible-project] Output from "fail" too verbose

2018-08-24 Thread Uwe Sauter
Hi all, I have a list of files where I need to check existence and fail if one doesn't exist. I'd expect the fail module to *just* output the defined message when the condition is true but instead the complete item is printed. Is there a way to make the output less verbose (but keep msg)?

[ansible-project] How to recover from expected connection loss?

2018-04-11 Thread Uwe Sauter
Hi all, I'm trying to reduce the size of the locale archive on CentOS 7.4 as described in [1] and [2]. Ansible version is 2.4.2.0-2.el7 For this I have a script on the client, that calls the needed commands: ## /root/bin/rebuild_locale.sh #!/bin/bash LOCALES="en_US:de_DE" mv

Re: [ansible-project] Re: Ansible - loop through multiple files when with_items defined

2018-01-29 Thread Uwe Sauter
You're welcome. Am 29.01.2018 um 19:32 schrieb John Harmon: > > Uwe Sauter, > > It worked perfectly!  Thank you. > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this

Re: [ansible-project] Ansible - loop through multiple files when with_items defined

2018-01-29 Thread Uwe Sauter
What's wrong with "with_nested"? # - name: Update ifcfg-* files ini_file: path: "{{ net_path }}{{ item[1] }}" no_extra_spaces: true section: null state: present option: "{{ item[0].option }}" value: "{{ item[0].value }}" with_nested: - [{ option:

Re: [ansible-project] include_tasks: multipe yml files

2018-01-23 Thread Uwe Sauter
What about: - include_tasks: '{{ item }}' with_items: - test.yml - test2.yml - test3.yml when:install_type |lower |search ("n") Am 23.01.2018 um 23:44 schrieb John Harmon: I can't seem to find examples on this that show more than one task/yml file.  How can I specify multiple

Re: [ansible-project] When statements should not include jinja2 templating delimiters such as {{ }} or {% %}

2017-09-01 Thread Uwe Sauter
Already did in my previous answer. You need to remove items like {{ }} or {% %}. Am 01.09.2017 um 10:18 schrieb Prologas: > Can you take an example of correct syntax? > > On Friday, September 1, 2017 at 11:15:09 AM UTC+3, Uwe Sauter wrote: > > There has been a change (I th

Re: [ansible-project] When statements should not include jinja2 templating delimiters such as {{ }} or {% %}

2017-09-01 Thread Uwe Sauter
There has been a change (I think between 1.9 and 2.x). As the warning explains, you should rewrite your when statement: when: - ansible_default_ipv4.macaddress == wildfly_vm1_server_macaddress Am 01.09.2017 um 10:07 schrieb Prologas: > Hello, > > strange output comes to my ansible console,

Re: [ansible-project] How to make ansbile output ordered?

2017-08-29 Thread Uwe Sauter
Due to the nature of asynchronous execution I don't think there is a way to do what you want to achieve. If you can afford the time you could serialize your playbooks by putting "serial: 1" on the same level as "hosts". But even then I'm not sure in which host order Ansible executes the

Re: [ansible-project] Using with_items with a dictionary

2017-08-29 Thread Uwe Sauter
HANGELOG.md >     - composer.json >     - .editorconfig >     - .gitignore >     - index.php >     - LICENSE.txt >     - system >     - vendor >   tags: grav, grav-sites > > > On Mon, Aug 28, 2017 at 12:52 PM, Uwe Sauter <uwe.sauter...@gmail.com > <mai

Re: [ansible-project] Using with_items with a dictionary

2017-08-28 Thread Uwe Sauter
I'm not quiet sure I understand your data model but instead of with_items have a look at with_dict. Am 28.08.2017 um 21:51 schrieb Michael Bushey: > Hello, > > I have a dict that contains a list of sites. For each of these sites I would > like to provide a list of symlinks to > create provided

Re: [ansible-project] Re: How would you approach this? Modifying DNS entries in ifcfg-* files

2017-08-28 Thread Uwe Sauter
I have a template for ifcfg-* files where I not only fill in DNS entries but also all the other network configuration stuff. I put this into a role and all variables are in host_vars/*.yaml files. Every time I wish to change the configuration I change the host_vars file and reapply the role

Re: [ansible-project] If get_url is cancelled on a large file following executions fail

2017-08-14 Thread Uwe Sauter
Did you look into "local_tmp" and "remote_tmp" configured in your Ansible config? Am 14.08.2017 um 21:46 schrieb 'Brian Williams' via Ansible Project: > If a playbook ever gets cancelled during the download of a large file the > following execution some systems get "No space > left on device"

[ansible-project] Access dynamically loaded variables by name

2017-08-14 Thread Uwe Sauter
Hi again, I'm looking for a way to merge multiple lists into one. Difficulty is that the lists have dynamic names. E.g. cluster.yaml --- racks: ['rack01', 'rack02'] # might be many more racks ## rack01.yaml --- rack_number: 1 compute_nodes: ['alpha',

[ansible-project] Variable expansion in include_vars

2017-08-14 Thread Uwe Sauter
Hi, I'm trying to keep my playbooks and related var files portable. Currently I'm stuck with the following: ### input.yaml ### --- base: '/exports' image: '{{ base }}/image' config: '{{ base }}/config' ### playbook ### --- - hosts: localhost connection: local gather_facts:

Re: [ansible-project] How to distribute public keys to every server except myself?

2017-08-04 Thread Uwe Sauter
Just to question the obvious: this is not the use case to distribute public keys into ~/.ssh/authorized_keys? If it is, use the "authorized_key" module… Am 04.08.2017 um 12:20 schrieb chbndrhnns: > Hey there, > > I have a setup with host1, host2, host3. I need to read a file into a >

Re: [ansible-project] Ansible tower behind nginx

2017-07-03 Thread Uwe Sauter
An uneducated guess: did you try to create the missing file? Am 03.07.2017 um 08:52 schrieb Luvpreet Singh: > On the official page, it is said that to host ansible tower behind nginx, you > need to provide headers in the > `/etc/tower/conf.d/remote_host_headers.py` file. > > But, in my

Re: [ansible-project] How do you send the ENTER keypressed to ansible's expect using shell command.

2017-04-26 Thread Uwe Sauter
Running the following playbook on localhost --- - hosts: localhost tasks: - name: "Run ssh commands for remove old id_rsa files and create new ssh keys" shell: ssh-keygen -f /tmp/id_rsa -t rsa -q -N "" args: creates: /tmp/id_rsa results in: ###$

Re: [ansible-project] How do you send the ENTER keypressed to ansible's expect using shell command.

2017-04-26 Thread Uwe Sauter
enied.", "stdout": "Saving the key failed: /home/dp794d/.ssh/id_rsa.", "stdout_lines": ["Saving the key failed: /home/dp794d/.ssh/id_rsa."], "warnings": []} I am doing something wrong, as this is new thing for me. Please suggest On Wednesday, 26 Ap

Re: [ansible-project] How do you send the ENTER keypressed to ansible's expect using shell command.

2017-04-26 Thread Uwe Sauter
Why don't you run "ssh-keygen -f -t -q -N ''" ? Am 26.04.2017 um 19:42 schrieb nishant bawane: Hi below is the command i want to run using shell to create the keys. shell: ssh dp794d@130.6.50.132 "cd /home/dp794d/.ssh;ssh-keygen" When i run this command on server, it askes to press the

Re: [ansible-project] .yml is failing with syntax error -- need advise

2016-11-13 Thread Uwe Sauter
Try the attached Python script. But probably you just have the wrong number of spaces for indentation. Try: --- - hosts: node02 vars: ORACLE_BASE: /u01/oracle/product ORACLE_HOME: /u01/oracle/product/11.2.0 remote_user: oracle sudo_user: root sudo: false

Re: [ansible-project] Retaining double-quotes in resulting file created from template

2016-11-02 Thread Uwe Sauter
Putting single quotes around should solve this. host_ip = '"http://{{ ansible_default_ipv4.address }}"' Regards, Uwe Am 02.11.2016 um 21:04 schrieb ZillaYT: > I have a template that does has this line > > | > host_ip ="http://{{ ansible_default_ipv4.address }}" > | > > which results

[ansible-project] Re: Location of host and group configuration

2016-09-01 Thread Uwe Sauter
└── inventory Regards, Uwe Am 01.09.2016 um 12:29 schrieb ankur.c...@gmail.com: > It can be inside the same folder as the playbook. > > root > -- group_vars/all.yml > -- host_vars/some_host.yml > -- myPlaybook.yml > > On Thursday, September 1, 2016 at

[ansible-project] Location of host and group configuration

2016-09-01 Thread Uwe Sauter
Hi all, I'm currently struggling with how to tell Ansible where it can find host_vars and group_vars folders. Is there an environmet variable for it? Does it have to be inside the same folder as the playbook? Regards, Uwe -- You received this message because you are subscribed to the

[ansible-project] Unsure about YAML syntax

2016-06-08 Thread Uwe Sauter
Hi all, I'm a bit unsure about YAML syntax regarding lists. Could someone please verify that the following two lists are equivalent? No indentation for list items: --- test: - a - b - c Indentation for list items: --- test: - a - b - c Thanks, Uwe -- You received this

Re: [ansible-project] redhat-subscription module functionality enhancement

2016-06-06 Thread Uwe Sauter
I'd really like to see some improvements to this module as well. The current situation keeps me from using it. Instead I also have a bunch of shell tasks that handle registering and attaching a host to a specific pool. The problem I have with this module is that there is an argument called

[ansible-project] redhat_subscription and pool ID

2016-04-09 Thread Uwe Sauter
Hi, I'm trying to use redhat_subscription to register and subscribe hosts by pool ID, not subscription name. Is this possible? As I have several subscriptions that overlap in some features I'd like to be explicit about which host gets subscribed to which pool by using the unique pool ID.

Re: [ansible-project] using a variable as a group name when executing a task ?

2015-11-13 Thread Uwe Sauter
What about: - vars: monitor_group: "glance" - hosts: "{{ monitor_group }}" roles: - { role: icinga2-check-commands, tags: ['monitor-cloud'] } I'm not saying that this'll work as I am trying to figure out variables myself. But you could give it a try. Am 13.11.2015 um 16:53 schrieb

Re: [ansible-project] using a variable as a group name when executing a task ?

2015-11-13 Thread Uwe Sauter
his. > The monitor_cloud variable is in the [all:vars] section of the inventory. > > On Friday, November 13, 2015 at 12:58:44 PM UTC-3, Uwe Sauter wrote: > > What about: > > - vars: > monitor_group: "glance" > - hosts: "{{ monito

Re: [ansible-project] Ensure that file 1 (authorized_keys) contains file 2 (id_ed25519.pub)

2015-11-03 Thread Uwe Sauter
Thanks Brian! Am 03.11.2015 um 00:47 schrieb Brian Coca: > that is what the authorized_keys module is for > http://docs.ansible.com/ansible/authorized_key_module.html, use that > instead to copy the public key. Also you should not be copying the > private key. > -- You received this message

[ansible-project] Ensure that file 1 (authorized_keys) contains file 2 (id_ed25519.pub)

2015-11-02 Thread Uwe Sauter
Hi all, just beginning my adventure with Ansible. Following situation: I'm trying to ensure that a user called "ansible" is present on all hosts that should be managed by Ansible. Creating group and user works so far. Now I'm trying to enable password-less SSH login for that user by copying a

Re: [ansible-project] sg: ERROR! ssh connection closed waiting for password prompt, Error

2015-07-13 Thread Uwe Sauter
Can you access your host via SSH keys? You cannot use Ansible in a productive environment when you are asked for the password at each run… Am 13.07.2015 um 08:43 schrieb Gaurav Suryagandh: Hello All, I am trying to use script module of ansible to execute my local script on the remote

Re: [ansible-project] Ping Module : Why ansible wants to SSH to the server for which I am trying a ping?

2015-06-22 Thread Uwe Sauter
The ping module is *NOT* Ansible trying to reach a host via ICMP message. Ansible will try to connect to the host via SSH and execute the ping module which just generates a pong answer. Am 20.06.2015 um 18:36 schrieb Suneel Gali: Hi Team, I just started working on ansible and using online

Re: [ansible-project] Ansible capable of handling diskless clients?

2015-05-29 Thread Uwe Sauter
Brian, thanks for your answer. As I'm not yet familiar with Ansible, do you have any pointers to documentation where I can find what you described (esp. the last point about additional pathing)? Am 29.05.2015 um 00:18 schrieb Brian Coca: I don't see a reason it would not. First ansible

[ansible-project] Ansible capable of handling diskless clients?

2015-05-28 Thread Uwe Sauter
Hi all, a similar question was already posted on Serverfault (http://serverfault.com/questions/693698/config-management-for-nfs-root-cluster) but got turned down as being off-topic. To summarize: Is Ansible capable of handling diskless clients that only have read-only storage mounted (besides