[ansible-project] How do I assign different variable values for different group system

2019-12-12 Thread Xinhuan Zheng
Hello, I'm trying to create an Ansible role, networking, to automate /etc/resolv.conf file. I created this role like below: production networking.yml group_vars/ agroup bgroup roles/ networking/ tasks/main.yml templates/resolv.conf.j2 In my resolv.conf.j2 file, I put variables in

[ansible-project] Define global variables in ansible group_vars/all file

2019-12-06 Thread Xinhuan Zheng
perating system after kickstarting - hosts: all roles: - role: os-issue It is to set /etc/issue file for remote myserver. Please advise me how I can define global variables in group_vars/all file. Thank you, - Xinhuan Zheng -- You received this message because you are subscribed to

Re: [ansible-project] Define global variables in ansible group_vars/all file

2019-12-06 Thread Xinhuan Zheng
ll > remote_user: ansible > become: yes > become_method: sudo > > Cheers, > > -vlado > I changed per advice. Here is my changed file: --- # group_vars/all remote_user: ansible become: yes become_method: sudo However, this doesn't work either. I got same Permis

Re: [ansible-project] Define global variables in ansible group_vars/all file

2019-12-06 Thread Xinhuan Zheng
> using SSH keys, does the ‘ansible’ user have permission to access the > correct key? > > See > https://docs.ansible.com/ansible/latest/user_guide/connection_details.html#ssh-key-setup > for > information on setting up SSH keys. > > Hope this helps point you in t

Re: [ansible-project] Define global variables in ansible group_vars/all file

2019-12-06 Thread Xinhuan Zheng
ick Visser wrote: > > And if you add the ‘-b’ option to that? > > On Fri, 6 Dec 2019 at 18:15, Xinhuan Zheng > wrote: > >> Hello Alicia, >> >> I just ran ad-hoc command with -u ansible parameter like below: >> >> $ ansible all -i production -u ansible -l

[ansible-project] Re: Define global variables in ansible group_vars/all file

2019-12-06 Thread Xinhuan Zheng
in playbook, but not in inventory, although those variables are not put in inventory file, I believe, they are inventory variables. The correct names when putting in group_vars/all file are: --- # group_vars/all ansible_user: ansible ansible_become: true ansible_become_method: sudo - Xinhuan

[ansible-project] Not replacing invalid character(s) in group name warning

2019-12-20 Thread Xinhuan Zheng
Hello, I'm using Ansible group_by for networking specific information configuration. I need to use group_by to collect data values from my group_var/subnet_ file. My group_vars/subnet_192.168.101.0 matches group_by key. Here is my playbook: - name: Group system by subnet group_by:

[ansible-project] How to build Ansible inventory file

2020-02-13 Thread Xinhuan Zheng
[development:children] myservice1 myservice2 load_balancers Is it a good practice to break down one big inventory file containing a lot of services into inventory files just for that service like the first one? Thank you, - Xinhuan Zheng -- You received this message because you are subscribed

[ansible-project] "ONE" inventory question

2020-02-26 Thread Xinhuan Zheng
ctice, does everyone maintain their inventory file in one single version control repository, or in multiple version control repositories? Would multiple inventory files in multiple version control repositories create inconsistency issue? Thanks, - Xinhuan Zheng -- You received this

[ansible-project] Re: How to build Ansible inventory file

2020-02-26 Thread Xinhuan Zheng
Hello All, I'm still patiently waiting for someone to give me some hint on below questions. Thanks - Xinhuan Zheng On Thursday, February 13, 2020 at 4:46:35 PM UTC-5, Xinhuan Zheng wrote: > > Hello, > > I need to build Ansible inventory files, but somehow got stuck. Typically >

[ansible-project] Netscaler Ansible question

2020-02-26 Thread Xinhuan Zheng
quot;test-lbvserver" servicetype: "HTTP" ipv46: "10.10.10.10" port: "80" lbmethod: "ROUNDROBIN" servicebindings: - servicename: "{{ item.servicename }}" weight: "{{ item.weight }}"

Re: [ansible-project] "ONE" inventory question

2020-02-27 Thread Xinhuan Zheng
t and how things are deployed, and by what > people/teams. If you provide that context we can give it a try. > > On Wed, 26 Feb 2020 at 21:01, Xinhuan Zheng > wrote: > >> Hello, >> >> We have ansible code that are in version control repository. This makes

Re: [ansible-project] How do I include another playbook in current playbook?

2020-02-11 Thread Xinhuan Zheng
nsible/devel/user_guide/playbooks_reuse.html. > You may want to edit “another.yml” to make it a tasks file instead of a > playbook for greater flexibility. > > Hope this helps, > Alicia > > On Jan 22, 2020, at 3:24 PM, Xinhuan Zheng > wrote: > > > Take a look agai

[ansible-project] Re: Does current Ansible support templates macro?

2020-01-15 Thread Xinhuan Zheng
at 4:27:45 PM UTC-5, Xinhuan Zheng wrote: > > Hello, > > I'm working on a role for system SSSD daemon. I found this piece of code > online: > > https://github.com/picotrading/ansible-sssd/blob/master/templates/sssd.conf.j2 > > I have defined my own sssd_config var

Re: [ansible-project] Does current Ansible support templates macro?

2020-01-15 Thread Xinhuan Zheng
%} {{ i }} = {% endfor %} {% endfor %} I cannot figure out what to put after {{ i }}. Please HELP! Thank you, - Xinhuan Zheng On Tuesday, January 14, 2020 at 5:42:22 PM UTC-5, Vladimir Botka wrote: > > On Tue, 14 Jan 2020 13:27:45 -0800 (PST) > Xinhuan Zheng > wrote: > > >

Re: [ansible-project] Re: Does current Ansible support templates macro?

2020-01-15 Thread Xinhuan Zheng
Got this error: "AnsibleUndefinedVariable: 'list object' has no attribute 'items' for item.1.items() - Xinhuan On Wednesday, January 15, 2020 at 1:56:58 PM UTC-5, Vladimir Botka wrote: > > On Wed, 15 Jan 2020 19:47:23 +0100 > Vladimir Botka > wrote: > > > Fit the template to your needs. For

Re: [ansible-project] Re: Does current Ansible support templates macro?

2020-01-15 Thread Xinhuan Zheng
15 Jan 2020 10:40:53 -0800 (PST) > Xinhuan Zheng > wrote: > > > Tried what you said. Here is what {{ item }} look like: > > > > [(u'sssd', {u'debug_level': 5, u'reconnection_retries': 3, > > u'config_file_version': 2, u'sbus_timeout': 30})] > > [(u'service

Re: [ansible-project] Re: Does current Ansible support templates macro?

2020-01-16 Thread Xinhuan Zheng
-0800 (PST) > Xinhuan Zheng > wrote: > > > sssd_config: > > sssd: > > debug_level: 1 > > additional_key: additional_value > > another_addtional_key: another_additional_value > > nss: > >

Re: [ansible-project] Re: Does current Ansible support templates macro?

2020-01-16 Thread Xinhuan Zheng
. I'll remember this lesson. - Xinhuan On Wednesday, January 15, 2020 at 3:45:44 PM UTC-5, Vladimir Botka wrote: > > On Wed, 15 Jan 2020 11:57:49 -0800 (PST) > Xinhuan Zheng > wrote: > > > I tested the solution, it doesn't work. item.1 becomes: > > {u'id_provider'

[ansible-project] Does current Ansible support templates macro?

2020-01-14 Thread Xinhuan Zheng
ebug_level=1 config_file_version=2 Thank you, Xinhuan Zheng -- 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...@googl

Re: [ansible-project] How do I include another playbook in current playbook?

2020-01-22 Thread Xinhuan Zheng
> Take a look again at the example in > https://docs.ansible.com/ansible/latest/modules/import_playbook_module.html. > > To me it does not know where > > > roles: > - role: testrole1 > tags: testrole1 > > belongs. Should it be > > - hosts: mywebservers > gather_facts:

[ansible-project] How do I include another playbook in current playbook?

2020-01-22 Thread Xinhuan Zheng
mment back in `#- import_playbook: another.yml' line in current_playbook.yml file, I got below error: ERROR! 'roles' is not a valid attribute for a PlaybookInclude - import_playbook: another.yml ^ here How do I call another.yml playbook in my current_playbook.yml file? Thank you, - Xin

[ansible-project] Ansible firewalld module question

2020-01-16 Thread Xinhuan Zheng
Hello, In Ansible firewalld module: https://docs.ansible.com/ansible/latest/modules/firewalld_module.html?highlight=firewalld, in the examples like below: - firewalld: service: https permanent: yes state: enabled We want to make it more descriptive in our role's tasks/main.yml

[ansible-project] How do I use Ansible loop for generalizing things in a role

2020-01-08 Thread Xinhuan Zheng
hank you, - Xinhuan Zheng -- 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

[ansible-project] Force ansible-playbook to collect ansible facts

2019-12-26 Thread Xinhuan Zheng
Hello, I ran my ansible playbook, pb.yml file, with --tags, like following: ansible-playbook -i "192.168.100.1," pb.yml --tags "networking" ansible-playbook does NOT collect ansible facts. However, if I run it without --tages, the ansible facts are collected. Why is that? Here is my

Re: [ansible-project] Not replacing invalid character(s) in group name warning

2019-12-26 Thread Xinhuan Zheng
Hello, The group names by subnet will have dot. How do I change that to avoid dot characters? - Xinhuan On Saturday, December 21, 2019 at 2:27:52 AM UTC-5, Kai Stian Olstad wrote: > > On 20.12.2019 22:08, Xinhuan Zheng wrote: > >- name: Group system by subnet >

Re: [ansible-project] Force ansible-playbook to collect ansible facts

2019-12-26 Thread Xinhuan Zheng
> Because you have replaced the tags with the config tag. > > > I want to configure only networking part inside config. That is, config is parent level tag, I only want to invoke networking tag of the parent tag. Can I do that? BTW, below isn't working: ansible-playbook -i test -l

Re: [ansible-project] Not replacing invalid character(s) in group name warning

2019-12-27 Thread Xinhuan Zheng
Hello Mr. Kai, I used {{ ansible_default_ipv4.network.replace('.', '_') }} and created group_vars/subnet_xxx_xxx_xxx_xxx. It worked perfectly. Thank you very much for help! - Xinhuan -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To

Re: [ansible-project] Force ansible-playbook to collect ansible facts

2019-12-27 Thread Xinhuan Zheng
Hello Mr. Kai, Sorry for not being clear. What I'm working on is probably a big playbook. So I used Ansible roles wisdom, for code re-usability. The main playbook will invoke each role as I develop, and I need to debug each role by calling the main playbook. That's why I figure it to use tags,

[ansible-project] Re: Running Ansible ping and getting error: Operation not permitted\r\n",

2019-12-27 Thread Xinhuan Zheng
On Thursday, December 26, 2019 at 11:49:26 AM UTC-5, gefela wrote: > > > When I am running a ansible ping from a ubuntu VM to a host using the > command > > ansible -m ping juniper > > It gives me the error message ... > > > > WARNING]: Platform freebsd on host 172.16.203.122 is using the

[ansible-project] Ansible URI and GET_URL does not work for downloading

2020-04-02 Thread Xinhuan Zheng
Hello, I need to use Ansible URI and GET_URL to download a piece of software called amanda backup server. I'm getting trouble with downloading. This is my playbook: - name: Create cookie for later request uri: url:

Re: [ansible-project] Ansible URI and GET_URL does not work for downloading

2020-04-03 Thread Xinhuan Zheng
t. Now it is working for me too. Thanks! - Xinhuan On Thursday, April 2, 2020 at 5:56:16 PM UTC-4, Kai Stian Olstad wrote: > > On Thu, Apr 02, 2020 at 02:21:35PM -0700, Xinhuan Zheng wrote: > > Hello, > > > > I need to use Ansible URI and GET_URL to download a piece

[ansible-project] Generate HTML Table from Ansible Inventory File

2020-08-28 Thread Xinhuan Zheng
and their values becomes HTML Table. How do I use Ansible playbook to accomplish it? Thank you, Xinhuan Zheng -- 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

[ansible-project] How to structure variables to distinguish different environments

2020-07-01 Thread Xinhuan Zheng
Hello, I want to define a variable for playbook in *group_vars/server_genre* file. However, I don't know if Ansible can support something like server_genre@environment syntax notation. Here is the detail: *In inventory/environment*: --- [server_genre] myserver1.example.com *In

Re: [ansible-project] How to structure variables to distinguish different environments

2020-07-07 Thread Xinhuan Zheng
cts > > Example > > set_facts: >nfs_server: xyx > when: ansible_distribution= 'CentOS' > > set_fact: >nfs_server: abc > when: ansible_distribution ='Ubuntu' > > On Thu, Jul 2, 2020 at 12:26 AM Xinhuan Zheng > wrote: > >> Hello, >> &g