[ansible-project] How to detect AWS instance type

2019-02-25 Thread Frank Dias
I have an old playbook that will add an addition volume and it works fine on t2 instances. With the move to t3 instances we also now have nvme based ebs. The play book uses lvm to setup the second volume we add the volume as xvdf so /dev/xvdf. Now on t3 instances when we add the volume as xvdf

Re: [ansible-project] Appending a line in a file

2019-02-25 Thread 'Larry Pescatore' via Ansible Project
Thank you sir, I am trying to find out how that exactly would look in my file (I am new to regexp so please forgive me). Heres what my file looks like: cat /etc/hosts 127.0.0.1 localhost 127.0.1.1 server-rack5-test-server-5 What I need it to change to (on a dynamic level, as in "server-rack5-tes

Re: [ansible-project] Appending a line in a file

2019-02-25 Thread fusillator
I don't know if I got your specification correctly anyway this is an example $ cat lineinfile.yml - hosts: localhost tasks: - name: lineinfile lineinfile: path: ./hosts regexp: '^(.*) server\.corp\b(.*)$' line: '\1 server.corp server.corp.company.com \2' bac

Re: [ansible-project] Appending a line in a file

2019-02-25 Thread 'lpescat...@google.com' via Ansible Project
Thanks kylix, Where would the append go? Sent from my iPhone. Please excuse any typos. > On Feb 25, 2019, at 6:10 PM, Kylix Kumar wrote: > > > >> On Feb 25, 2019, at 6:01 PM, 'lpescat...@google.com' via Ansible Project >> wrote: >> >> Thanks Luca, I sorta thought that was it, could you gi

Re: [ansible-project] Appending a line in a file

2019-02-25 Thread 'lpescat...@google.com' via Ansible Project
Thanks Luca, I sorta thought that was it, could you give a quick example on how the file would look? Sent from my iPhone. Please excuse any typos. > On Feb 25, 2019, at 5:46 PM, Luca Cazzaniga wrote: > > Hi try the module lineinfile, see the manual page at > https://docs.ansible.com/ansible/

Re: [ansible-project] Appending a line in a file

2019-02-25 Thread Luca Cazzaniga
Hi try the module lineinfile, see the manual page at https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html Il giorno mar 26 feb 2019, 02:30 lpescatore via Ansible Project < ansible-project@googlegroups.com> ha scritto: > Hi, > I want to add some stuff to my /etc/hosts file. > For

[ansible-project] Appending a line in a file

2019-02-25 Thread lpescatore via Ansible Project
Hi, I want to add some stuff to my /etc/hosts file. For instance, if my /etc/hosts says "server.corp", I want to append that in all my machines to where it says "server.corp.company.com". Then I want it to save. What is the best module for that , and can you tell me what the play might look li

Re: [ansible-project] Re: setting variable in a playbook from a jinjia2 snippet

2019-02-25 Thread fusillator
Thanks for the tip Jon. So if the variable was necessary in subsequent tasks I could use set_fact module rather than defining a variable in the scope of the task or play do you mean something like... - name: "list files in an archive" unarchive: src: /root/mybundle.zip dest:

Re: [ansible-project] error run shell script for start service jboss

2019-02-25 Thread Jhon J. Castro H.
Thanks for you answer! Effectively ansible did not get the environment variables from vm: *stdout Playbook:* "stdout": "=\n\n JBoss Bootstrap Environment\n\n JBOSS_HOME: /home/jboss/jboss-6.4\n\n JAVA: java\n\n

Re: [ansible-project] Ansible Failed Authentication

2019-02-25 Thread VeGeTa-X
before my issue I was missing connection: local now I am able to run and I am getting message below I have doubled checked my username and password below is my .yaml syntax TASK [show version] *

Re: [ansible-project] Ansible Failed Authentication

2019-02-25 Thread VeGeTa-X
ok fixed my issue I was missing "connection:local" in my playbook thx for your help On Monday, February 25, 2019 at 1:05:33 PM UTC-5, VeGeTa-X wrote: > > when I do a ansible all -i inventory/inv_sjc_core -u vegeta -m ping -k > it does not authenticate but if I do a "ssh -l vegeta vegeta01_temp"

Re: [ansible-project] Ansible Failed Authentication

2019-02-25 Thread VeGeTa-X
when I do a ansible all -i inventory/inv_sjc_core -u vegeta -m ping -k it does not authenticate but if I do a "ssh -l vegeta vegeta01_temp" it works vegeta01_temp | UNREACHABLE! => { "changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able

Re: [ansible-project] Re: How can I loop over all hosts in a group in this playbook?

2019-02-25 Thread Kai Stian Olstad
On 25.02.2019 18:08, Venkata Vuppala wrote: > I was trying to write IPtable rules for database servers in ansible, > wherein every time an admin server is added into the environment it should > be allowed to ssh to the database server. > I tried to use Matt's idea of with_items and tried to call ho

[ansible-project] Re: How can I loop over all hosts in a group in this playbook?

2019-02-25 Thread Venkata Vuppala
Hi Kai, I was trying to write IPtable rules for database servers in ansible, wherein every time an admin server is added into the environment it should be allowed to ssh to the database server. I tried to use Matt's idea of with_items and tried to call hosts listed in the admin:children ( in th

Re: [ansible-project] How can I loop over all hosts in a group in this playbook?

2019-02-25 Thread Kai Stian Olstad
On 25.02.2019 17:36, Venkata Vuppala wrote: > Thanks for the with_items variable, but can this looping system be used to > scan for hosts deep inside the inventory file rather than groups (a child > group? ) nsible inventory kind of a flat structure, groups and hosts. > admin-1/2 are hosts here

Re: [ansible-project] How can I loop over all hosts in a group in this playbook?

2019-02-25 Thread Venkata Vuppala
Hi Matt, Thanks for the with_items variable, but can this looping system be used to scan for hosts deep inside the inventory file rather than groups (a child group? ) admin-1/2 are hosts here. I am using Ansible 2.4 Eg: [admin:children] admin-1 admin-2 I did try with the below syntax, but it

[ansible-project] Can network_cli or expect run tasks via SSH on simple embedded devices?

2019-02-25 Thread 'CodeWaffle' via Ansible Project
Hi all: Not sure if I'm going about this the right way since I'm pretty new to Ansible. Bu, can something like "network_cli" be used to drive simple to simple embedded devices over SSH in an expect-like manner? I've got a few devices that don't have a custom network_os or custom Ansible module

[ansible-project] Unable to connect via jump-server. Do not understand why control socket is missing

2019-02-25 Thread notes
According to the docs setting* ProxyCommand* in *ansible_ssh_command_args* will enable access to private servers via a jump server. I am atte

[ansible-project] Ansible connection chroot on remote target

2019-02-25 Thread Chiku
Hello, In documentation, I see there is chroot connection type, but it looks like for local target only. How can run ansible tasks in a chroot on remote target? Thank you. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe f

Re: [ansible-project] network-engine - parser problem

2019-02-25 Thread Trishna Guha
On Fri, Feb 22, 2019 at 9:25 PM andybourges via Ansible Project wrote: > > Hi Trishna, > Thanks for your reply. I finally got it by using your recommendation above. > But had to concat/string-replace the 'add ' keyword within that string, which > brings me back to my initial question: is it poss

[ansible-project] Re: with blockinfile module, I'm looking for option to check the entries whether its present or not! if not then entries have to be added by play.

2019-02-25 Thread Deepan M
Thank you James, its working fine. Thanks, Deepan M On Monday, February 25, 2019 at 6:38:36 PM UTC+5:30, Deepan M wrote: > > > > Hello, > > Can someone please help to solve my request? > > with blockinfile module, I'm looking for option to check the entries > whether its present or not! if not

[ansible-project] How can i resolve dependencies for ansible 2.7 rpm install

2019-02-25 Thread Bharath Kumar Gajjela
Hello, Iam installing ansible 2.7 on rhel6,python 2.6 and i got below error. rpm -ivh ansible-2.7.7-1.el6.ans.noarch.rpm warning: ansible-2.7.7-1.el6.ans.noarch.rpm: Header V4 RSA/SHA1 Signature, NOKEY error: Failed dependencies: PyYAML is needed by ansible-2.7.7-1.el6.ans.noarch python-jinja2 i

Re: [ansible-project] Use a variable from another host's variables

2019-02-25 Thread Kai Stian Olstad
On 25.02.2019 14:46, adsquai...@gmail.com wrote: > The issue was not so much with the quoting ( I tried that as well before > posting ) but the value host_a after hostvars. Ansible was looking for the > IP address under the host heading. > Ex. {{ hostvars['x.x.x.x'][eth0] }} Of course, is't a grou

Re: [ansible-project] How can i run a block of playbook instructions only if they pass the specified condition?

2019-02-25 Thread Kai Stian Olstad
On 25.02.2019 13:55, Ankit wrote: > What is the best and least time consuming way of doing this? I was checking > the documentation for *block *but i am not sure if i can use the conditions > for a block. Why not just test it? or check the documentation for what block support? https://docs.ansible.

Re: [ansible-project] Use a variable from another host's variables

2019-02-25 Thread adsquaired
The issue was not so much with the quoting ( I tried that as well before posting ) but the value host_a after hostvars. Ansible was looking for the IP address under the host heading. Ex. {{ hostvars['x.x.x.x'][eth0] }} Is there another way to do this? I would prefer not to put the IP or a DNS

Re: [ansible-project] with blockinfile module, I'm looking for option to check the entries whether its present or not! if not then entries have to be added by play.

2019-02-25 Thread James Cassell
On Mon, Feb 25, 2019, at 8:08 AM, Deepan M wrote: > > > > > Hello, > > Can someone please help to solve my request? > > with blockinfile module, I'm looking for option to check the entries > whether its present or not! if not then entries have to be added by play. > > As per below my p

[ansible-project] Vault encrypting password over the network or just locally

2019-02-25 Thread boncalo mihai
Hi, I'm trying to secure my ansible playbook and one of the steps is securing the password. I know that I can store the password encrypted inside ansible vault and than use directly from the vault and send it over the network (e.g. change pass) but the question is, the password is decrypted and se

[ansible-project] with blockinfile module, I'm looking for option to check the entries whether its present or not! if not then entries have to be added by play.

2019-02-25 Thread Deepan M
Hello, Can someone please help to solve my request? with blockinfile module, I'm looking for option to check the entries whether its present or not! if not then entries have to be added by play. As per below my playbook, its working partially, like its appending even if the entries are a

[ansible-project] How can i run a block of playbook instructions only if they pass the specified condition?

2019-02-25 Thread Ankit
I have got a playbook where i need to check if the host fact for reboot is set to true, i need to execute the rest of the instructions for that particular host in the inventory only if the reboot condition is true. Following is the playbook. I would like to avoid executing all the tasks for the

Re: [ansible-project] Re: setting variable in a playbook from a jinjia2 snippet

2019-02-25 Thread Jon Spriggs
Also, look at the set_fact module, I use this extensively! -- Jon "The Nice Guy" Spriggs @jontheniceguy everywhere... https://jon.sprig.gs On Fri, 22 Feb 2019 at 11:45, fusillator wrote: > Sorry for the stupid question > solved with > > - name: "debug archive_content" > debug: > var

Re: [ansible-project] Dealing with non-fixed length lists of variables

2019-02-25 Thread Jon Spriggs
Why not structure your data like this: --- - hosts: all vars: provider: password: Password server: IP user: username validate_certs: no server_port: port mapping: # This is new and might be stored elsewhere :) server1.example.com: 192.0.2.1 server2.example.c