[ansible-project] Is a file level group possible for multiple inventory files in directory?

2020-03-09 Thread Josef Fortier
I have two different organizations managed in two separate files, with some 
overlap in roles.
I'm currently manually creating groups within each file target hosts in 
that file (conceptually "organization").
I'd like to have an automatic variable that is constructed by file scope.
Is this possible?
Is it already provided (and I've missed it in the docs)?

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/66105db2-ec5b-4362-9e19-e1563c167e75%40googlegroups.com.


Re: [ansible-project] apt-add-repository ppa:ansible/ansible timeout?

2020-03-09 Thread Dick Visser
No idea, but if it does for you for that repo, and it doesn't for
other repos, then it's something specific to the repo.



On Mon, 9 Mar 2020 at 18:53, Joshua Goldman  wrote:
>
> Is adding the repository timing out for anyone else?
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/d18a11ee-ba84-463a-9e9b-f29124cf66e4%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwNrM3nZSd3A8hG9yYSTAanuauCk-3UEgi2rYOv3KjaaVQ%40mail.gmail.com.


Re: [ansible-project] Unexpected parameter type in new Ansible role

2020-03-09 Thread Dick Visser
Hi


On Mon, 9 Mar 2020 at 18:48, harry devine  wrote:

> The main.yml under tasks is as follows:
>
> - name: Playbook to perform a repo sync from the sat server
>   hosts: localhost
>
>   tasks:
>   # Sync all repositories
>   - name: Get all repositories
> foreman_search_facts:
>   username: "{{sat_user}}"
>   password: "{{sat_passwd}}"
>   server_url: "https://{{sat_server_fqdn}};
>   resource: repositories
>   validate_certs: "{{validate_sat_cert}}"
> register: repositories
>
>
> Any ideas on what could be going on?

Yes, your main.yml should ONLY contain a list of tasks - you also have
hosts, and an actual tasks entry.
You can just strip the first lines and intend the rest, so your
main.yml look like this:

---
- name: Get all repositories
  foreman_search_facts:
username: "{{sat_user}}"
password: "{{sat_passwd}}"
server_url: "https://{{sat_server_fqdn}};
resource: repositories
validate_certs: "{{validate_sat_cert}}"
  register: repositories





-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwMCoiSsCL%2BxWsFTEMnhupfMMte1Er%2B_qNFKTQR%2BdibwwQ%40mail.gmail.com.


[ansible-project] apt-add-repository ppa:ansible/ansible timeout?

2020-03-09 Thread Joshua Goldman
Is adding the repository timing out for anyone else?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d18a11ee-ba84-463a-9e9b-f29124cf66e4%40googlegroups.com.


[ansible-project] Unexpected parameter type in new Ansible role

2020-03-09 Thread harry devine
I'm trying to create a role that will update Satellite content views using 
the Foreman/Katello modules.  Here's what the role tree looks like:

 [root@server1 /etc/ansible/roles/foreman_content_views]#tree
.
├── defaults
│   └── main.yml
├── tasks
│   ├── clean_cv.yml
│   └── main.yml
└── vars
└── main.yml

3 directories, 4 files

If I check the syntax on each YML file using "ansible-playbook 
--syntax-check" they check out fine.  But when I run the main playbook, I 
get the following error after I include the role:

PLAY [Manage Satellite Content Views] 
**

TASK [Manage Satellite Content Views] 
**
ERROR! unexpected parameter type in action: 

The error appears to be in 
'/etc/ansible/roles/foreman_content_views/tasks/main.yml': line 1, column 
3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Playbook to perform a repo sync from the sat server
  ^ here

Here's the main playbook I'm running to start the run:
---
- name: "Manage Satellite Content Views"
  hosts: server1
  gather_facts: no

  tasks:
- name: "Manage Satellite Content Views"
  include_role:
name: "foreman_content_views"

The main.yml under tasks is as follows:

- name: Playbook to perform a repo sync from the sat server
  hosts: localhost

  tasks:
  # Sync all repositories
  - name: Get all repositories
foreman_search_facts:
  username: "{{sat_user}}"
  password: "{{sat_passwd}}"
  server_url: "https://{{sat_server_fqdn}};
  resource: repositories
  validate_certs: "{{validate_sat_cert}}"
register: repositories


Any ideas on what could be going on?

Thanks,
Harry

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0d3ab447-7a8a-4cb8-86e1-1cb12365649b%40googlegroups.com.


[ansible-project] SSL: DH_KEY_TOO_SMALL in ACI module

2020-03-09 Thread Ben Sikkens
Hi,

I ran into an issue after updating to Ansible 2.8.5 (in AWX 9.1.1)
This used to work in the previous version (Ansible 2.8.1, AWX 6.0.0.0)
I fixed some issues from the python 2 to 3 but this one eludes me.

I'm trying here to create a Bridge Domain

I can provide extra info tomorrow as the networking guys who maintain this 
project are already gone. So if you need any extra info please ask.

{
"msg": "Connection failed for 
https://host.name/api/mo/uni/tn-VALUE/BD-BD_000_ACI_test.json. Request 
failed: ",
"changed": false,
"invocation": {
"module_args": {
"hostname": "host.name",
"username": "cw-user",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"bd": "BD_000_ACI_test",
"arp_flooding": true,
"l3_unknown_multicast": "flood",
"enable_routing": true,
"vrf": "VALUE",
"tenant": "VALUE",
"l2_unknown_unicast": "flood",
"state": "present",
"validate_certs": false,
"host": "host.name",
"output_level": "normal",
"timeout": 30,
"use_proxy": true,
"use_ssl": true,
"port": null,
"private_key": null,
"certificate_name": null,
"bd_type": null,
"description": null,
"enable_multicast": null,
"endpoint_clear": null,
"endpoint_move_detect": null,
"endpoint_retention_action": null,
"endpoint_retention_policy": null,
"igmp_snoop_policy": null,
"ip_learning": null,
"ipv6_nd_policy": null,
"limit_ip_learn": null,
"mac_address": null,
"multi_dest": null,
"gateway_ip": null,
"scope": null,
"subnet_mask": null,
"protocol": "https"
}
},
"ansible_facts": {
"discovered_interpreter_python": "/usr/libexec/platform-python"
},
"_ansible_no_log": false
}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/98a11f7c-d1f3-487a-9a8f-bb6c18739f78%40googlegroups.com.


Re: [ansible-project] file not found

2020-03-09 Thread Stefan Hornburg (Racke)
On 3/9/20 4:36 PM, gefela wrote:
> 
> I am trying to run a playbook and the details come from a file  but it is 
> giving me an error message
> 
> 
> ansible-playbook -i inventory junos_config.yml
> 
> PLAY [Juniper SRX configuration compliance checks] 
> *
> 
> TASK [Syslog server check] 
> *
> fatal: [172.16.203.121]: FAILED! => {"msg": "FileNotFoundError(2, 'No such 
> file or directory')"}
> 
> PLAY RECAP 
> *
> 172.16.203.121 : ok=0    changed=0    unreachable=0    failed=1   
>  skipped=0    rescued=0    ignored=0  

I have no clue about Juniper and the junos_config module, but it might be worth 
to run with - to see where
Ansible looks for the file.

Regards
Racke

> 
> This is the yaml file
> 
> ---
> 
> - name: Juniper SRX configuration compliance checks
>   hosts: juniper
>   gather_facts: false
>   tasks:
>   - name: Syslog server check
>     junos_config:
>   src: files/syslog_config
>   src_format: set
>   comment: Appropriate Syslog server configured
>     register: junos_output
>   - debug:
>    var: junos_output
>  
>   - name: print success
>     debug:
>   msg: Syslog server check - This check has passed with the following 
> output({{ junos_output }})
>     when: not junos_output.changed
>   
>   - name: print failed
>     debug:
>   msg: Syslog server check - This check has failed with the following 
> output({{ junos_output }})
>     when: junos_output.changed
>  
>    
>   - name: Admin credentials
>     junos_config:
>   src: files/admin_user
>   comment: admin user created and confirmed
>  
>    
>   - name: NTP check
>     junos_config:
>   src: files/NTP server
>   comment: correct NTP server
>  
>   - name: idle timeout check
>     junos_config:
>   src: files/idle timeout
>   comment: idle timeout confirmed
> 
>  
> 
> The structure of syslog file is
> cat files/syslog_config
> set system syslog archive size 30
> set system syslog archive files 3
> set system syslog archive world-readable
> set system syslog user * any emergency
> set system syslog host 192.168.100.70 any any
> set system syslog host 192.168.100.70 interactive-commands any
> set system syslog host 192.168.100.70 facility-override local1
> set system syslog host 192.168.100.70 log-prefix firewall
> set system syslog host 192.168.100.70 source-address "{{ inventory_hostname 
> }}"
> set system syslog host 192.168.100.70 explicit-priority
> set system syslog file messages any critical
> set system syslog file messages authorization info
> set system syslog file default-log-messages structured-data
> set system syslog file sessions user info
> set system syslog file interactive-commands interactive-commands error
> 
> 
> -- 
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/605b2514-739a-4281-93da-f4f437b368a8%40googlegroups.com
> .


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/887f2651-793a-d073-17cc-37a6f86396dc%40linuxia.de.


signature.asc
Description: OpenPGP digital signature


[ansible-project] file not found

2020-03-09 Thread gefela

I am trying to run a playbook and the details come from a file  but it is 
giving me an error message 


ansible-playbook -i inventory junos_config.yml 

PLAY [Juniper SRX configuration compliance checks] 
*

TASK [Syslog server check] 
*
fatal: [172.16.203.121]: FAILED! => {"msg": "FileNotFoundError(2, 'No such 
file or directory')"}

PLAY RECAP 
*
172.16.203.121 : ok=0changed=0unreachable=0
failed=1skipped=0rescued=0ignored=0   

This is the yaml file 

---

- name: Juniper SRX configuration compliance checks 
  hosts: juniper
  gather_facts: false
  tasks:
  - name: Syslog server check
junos_config:
  src: files/syslog_config
  src_format: set
  comment: Appropriate Syslog server configured 
register: junos_output
  - debug:
   var: junos_output
  
  - name: print success
debug:
  msg: Syslog server check - This check has passed with the following 
output({{ junos_output }})
when: not junos_output.changed 
   
  - name: print failed
debug:
  msg: Syslog server check - This check has failed with the following 
output({{ junos_output }})
when: junos_output.changed 
  

  - name: Admin credentials 
junos_config:
  src: files/admin_user
  comment: admin user created and confirmed 
  

  - name: NTP check 
junos_config:
  src: files/NTP server
  comment: correct NTP server 
  
  - name: idle timeout check 
junos_config:
  src: files/idle timeout
  comment: idle timeout confirmed 
 
 

The structure of syslog file is
cat files/syslog_config 
set system syslog archive size 30
set system syslog archive files 3
set system syslog archive world-readable
set system syslog user * any emergency
set system syslog host 192.168.100.70 any any
set system syslog host 192.168.100.70 interactive-commands any
set system syslog host 192.168.100.70 facility-override local1
set system syslog host 192.168.100.70 log-prefix firewall
set system syslog host 192.168.100.70 source-address "{{ inventory_hostname 
}}"
set system syslog host 192.168.100.70 explicit-priority
set system syslog file messages any critical
set system syslog file messages authorization info
set system syslog file default-log-messages structured-data
set system syslog file sessions user info
set system syslog file interactive-commands interactive-commands error


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/605b2514-739a-4281-93da-f4f437b368a8%40googlegroups.com.


Re: [ansible-project] Unable to substitute variable inside variable

2020-03-09 Thread Sanjay
Thanks, that seems  to be working!

On Monday, March 9, 2020 at 7:17:30 PM UTC+5:30, Vladimir Botka wrote:
>
> On Mon, 9 Mar 2020 06:06:39 -0700 (PDT) 
> Sanjay > wrote: 
>
> > Any idea/comments why this doesn't work? 
> > Installed aversion -  2.9.0 
> > 
> > Playbook : test.yml 
> > -- 
> >   - name: substitute vars 
> > hosts: localhost 
> > gather_facts: False 
> > vars_files: 
> >   - "vars.yml" 
> > tasks: 
> >   - name: print vars 
> > debug: msg="{{ vars.a }}" 
> > 
> > vars.yml 
> > a: "{{ lookup('env', 'HOME') }}" 
> > 
> > Output : 
> > TASK [print vars] 
> > ok: [localhost] => { 
> > "msg": "{{ lookup('env', 'HOME') }}" 
> > } 
> > 
> > Why it doesn't print the HOME env value? 
>
> There is no reason toreference "vars". Try 
>
>   debug: msg="{{ a }}" 
>
> HTH, 
>
> -vlado 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6456e0d3-94de-44b6-97b1-d2827e183cd7%40googlegroups.com.


Re: [ansible-project] Unable to substitute variable inside variable

2020-03-09 Thread Vladimir Botka
On Mon, 9 Mar 2020 06:06:39 -0700 (PDT)
Sanjay  wrote:

> Any idea/comments why this doesn't work?
> Installed aversion -  2.9.0
> 
> Playbook : test.yml
> --
>   - name: substitute vars
> hosts: localhost
> gather_facts: False
> vars_files:
>   - "vars.yml"
> tasks:
>   - name: print vars
> debug: msg="{{ vars.a }}"
> 
> vars.yml
> a: "{{ lookup('env', 'HOME') }}"
> 
> Output : 
> TASK [print vars] 
> ok: [localhost] => {
> "msg": "{{ lookup('env', 'HOME') }}"
> }
> 
> Why it doesn't print the HOME env value?

There is no reason toreference "vars". Try

  debug: msg="{{ a }}"

HTH,

-vlado

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200309144711.1f826864%40gmail.com.


pgpOKwVobVzMp.pgp
Description: OpenPGP digital signature


[ansible-project] Unable to substitute variable inside variable

2020-03-09 Thread Sanjay
Any idea/comments why this doesn't work?

Installed aversion -  2.9.0


Playbook : test.yml

-
--
  - name: substitute vars
hosts: localhost
gather_facts: False

vars_files:
  - "vars.yml"

tasks:
  - name: print vars
debug: msg="{{ vars.a }}"





vars.yml


a: "{{ lookup('env', 'HOME') }}"



Output : 


TASK [print vars] 
*
ok: [localhost] => {


"msg": "{{ lookup('env', 'HOME') }}"


}


Why it doesn't print the HOME env value?


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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/cbacd17d-62db-494d-a539-fb2ace9dbfbb%40googlegroups.com.


Re: [ansible-project] Jinja2 iterate over strings and lists

2020-03-09 Thread Quentin Aveno
Thanks, that's thé filter I looking for.
Have a nice nice day ! 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6fad696e-7905-4e86-bb58-3afac112%40googlegroups.com.


[ansible-project] How to get include_vars variable inside Jinja template ?

2020-03-09 Thread Shifa Shaikh
Experts Hi, 

I have couple of variable files like below:

$ cat vars_ip.yml
---
12.1.1.25: TAP1
12.1.1.26: TAP2
11.0.0.26: TAP3
11.0.0.27: TAP4
9.2.2.211: SAT1
9.2.2.212: SAT2
10.7.7.28: SAT3
10.7.7.29: SAT4
9.2.2.213: SAT5
10.7.7.30: SAT6


$ cat vars.yml

---
  layers:
- name: MY_LAYER
  things_prod:
- 12.1.1.25
- 12.1.1.26
  things_dr:
- 11.0.0.26
- 11.0.0.27
  bgcolor:
- '#AED6F1'


- name: YR_LAYER
  things_prod:
- 9.2.2.211
- 9.2.2.212
- 9.2.2.213
  things_dr:
- 10.7.7.28
- 10.7.7.29
- 10.7.7.30
  bgcolor:
- '#F9E79F'


Here is my playbook:

$ cat varloop.yml

---
  - name: Demonstrating variables in Jinja2 Loops
hosts: localhost
vars_files:
  - vars.yml
  - vars_ip.yml
gather_facts: no
tasks:
  - name: Create the Jinja2 based templateone
template: src=./varloop.j2 dest=./sync/sync.html


Here is my Jinja template file:

$ cat varloop.j2


{% for layer in layers %}
{% for item in layer.things_prod %}
{{ item }} {{ layer.things_dr[loop.index-1] }} var[{{ item }}] var[layer.
things_dr[loop.index-1]]
{% endfor %}
{% endfor %}


$ cat ./sync/sync.html
Output:

Current Output:
$ cat ./sync/sync.html


12.1.1.25 11.0.0.26 var[12.1.1.25] var[layer.things_dr[loop.index-1]]
12.1.1.26 11.0.0.27 var[12.1.1.26] var[layer.things_dr[loop.index-1]]
9.2.2.211 10.7.7.28 var[9.2.2.211] var[layer.things_dr[loop.index-1]]
9.2.2.212 10.7.7.29 var[9.2.2.212] var[layer.things_dr[loop.index-1]]
9.2.2.213 10.7.7.30 var[9.2.2.213] var[layer.things_dr[loop.index-1]]


I need the values from the vars_ip.yml variable file to be populated in the 
jinja template like below:

Expected output:
12.1.1.25 11.0.0.26 TAP1 TAP3
12.1.1.26 11.0.0.27 TAP2 TAP4
9.2.2.211 10.7.7.28 WAS1 WAS3
9.2.2.212 10.7.7.29 WAS2 TAP4
9.2.2.213 10.7.7.30 WAS3 WAS6

 Kindly suggests.





-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6fd3c5d7-2460-4afa-b9ad-22e5dfb19a57%40googlegroups.com.


[ansible-project] How to use same loop index for two list from variable file in Jinja template

2020-03-09 Thread Shifa Shaikh
I have a variable file like below:

12.1.1.25: TAP1
12.1.1.26: TAP2
11.0.0.26: TAP3
11.0.0.27: TAP4
9.2.2.211: SAT1
9.2.2.212: SAT2
10.7.7.28: SAT3
10.7.7.29: SAT4


  layers:
- name: MY_LAYER
  things_prod:
- 12.1.1.25
- 12.1.1.26
  things_dr:
- 11.0.0.26
- 11.0.0.27
  bgcolor:
- '#AED6F1'


- name: YR_LAYER
  things_prod:
- 9.2.2.211
- 9.2.2.212
- 9.2.2.213
  things_dr:
- 10.7.7.28
- 10.7.7.29
- 10.7.7.30
  bgcolor:
- '#F9E79F'


I need help with jinja template that give me the below output:


MY_LAYER
TAP1TAP3
file_12.1.1.25_11.0.0.26.txt
TAP2TAP4
file_12.1.1.26_11.0.0.27.txt


YR_LAYER
SAT1SAT3
file_9.2.2.211_10.7.7.28.txt
SAT2SAT4
file_9.2.2.212_10.7.7.29.txt
SAT3SAT6
file_9.2.2.213_10.7.7.30.txt

How can i have loop.index loop over both lists things_prod & things_dr 
simultaneaously for us to get say "file_12.1.1.25_11.0.0.26.txt" ?

Below is the approach I took so far:

{% for layer in layers %}



{% for item in layer.things_prod %}
vars[item] <-- dont know how to get corresponding 
variable for things_dr 
file_{{ item }}_{{ item }}.txt  <-- dont know how to get corresponding 
variable for things_dr


{% endfor %}

{% endfor %}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fa9de9eb-e7db-4f64-872c-6c0a127a9483%40googlegroups.com.