'center_id': item.center_id,
>
> 'center_password': lookup('pipe', 'pwgen -sy 48 1')
>
> }
>
>
> ]) }}
>
>
> loop: "{{ lookup('file', filename)|from_yaml|json_query('centers[]')
> }}"
>
>
> - copy:
>
>> Is this file local or on your remote host?
local
dick@geant.org 在 2021年11月5日 星期五下午3:04:57 [UTC+8] 的信中寫道:
> Is this file local or on your remote host?
>
> On Fri, 5 Nov 2021 at 02:13, Eric Chang wrote:
>
>> let's said I have a yaml file like
>>
let's said I have a yaml file like
centers.yml
centers:
- center_id: ABC123
center_password: 123456789
- center_id: 123ABC
center_password: ""
now I want to read the centers.yml , and update center_password with
pwgen(8) if center_password is null and write back to centers.yml
How
I have two dict file like
teams.yml
{
"teams": [{"gid": 10125,"location": ["hq"],"name": "aa","users":
["chenhu","chouf"]},
{"gid": 10126,"location": ["hq"],"name": "ac","users":
["guoj","yangc"]} ]
}
users.yml
{
"users": [{"name": "changc","uid": 2},
so , what module you recommend ?
Stefan Hornburg (Racke)於 2020年5月13日星期三 UTC+8下午10時12分58秒寫道:
>
> On 5/13/20 3:58 PM, Eric Chang wrote:
> > location is defined in inventory file , but I have trouble to update
> nodes.pub
> >
>
> lineinfile is not appropriate for any
efan Hornburg (Racke)於 2020年5月13日星期三 UTC+8下午4時03分16秒寫道:
>
> On 5/13/20 9:32 AM, Eric Chang wrote:
> > like I said , I want to update nodes.ma <http://nodes.ma> with
> somevalue based on location in playbook , if ma is not
> > defined.
> > ma is matai
ike doing things backwards.
> Could you tell more about your ACTUAL deployment goal(s)? I.e. what
> are you trying to achieve with ansible?
>
> On Wed, 13 May 2020 at 03:34, Eric Chang >
> wrote:
> >
> > I have a var file like
> >
> > nodes:
>
I have a var file like
nodes:
- name: rk12
location: tp-101
ma:
own:
- name: rk14
location: tp-201
ma: p11023
own: p11023
- name: rk15
location: tc-332
ma:
own: p92032
and I want to update nodes.ma with somevalue based on location in playbook
, if
I wrote a simple plabook to test ansible_play_name
---
> - hosts: localhost
>
> tasks:
> - name: ref playname
> debug:
> msg: ansible_play_name
>
I can run the playbook in ansible 2.8 , but get an error in ansible 2.9.2
ansible 2.8.0
>
> (.28) 2020-02-19 11:40:35
so any suggesions to combine multiple yaml files with same attributes ?
--
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
according to
https://docs.ansible.com/ansible/2.5/modules/include_vars_module.html
this task should load all yaml files in /home/yaml/users and assign to var
'users'
- name: load yaml using include_vars with dir
> include_vars:
> name: 'users'
> dir: /home/yaml/users/
>
thanks ! it's working now !
Stefan Hornburg (Racke)於 2020年2月14日星期五 UTC+8下午6時08分30秒寫道:
>
> >Try "{{ vars[item]['name'] }}". Only variables inside the double curly
> braces are evaluated.
>
> >Regards
> > Racke
>
> >
> > --
> > You received this message because you are subscribed to
I have dozens of yaml files , and I want to use these yaml files as vars in
playbook.
so I try to dynamic load vars like
aaa.yaml , bbb.yaml,ccc.yaml
- name: get all yaml files name
shell: find /home/yaml -name *.yamlawk -F "/" '{print $6}'|awk -F "."
'{print $1}'
register: yaml_files
I have a list like this
user:
name: chchang
comment: "Chang Chic Hung"
and I want to add more attrs like
last_name: Chang
mid_name: Chic
but how to get the specifed order of the values ?
I try to use filter "first" , but it just return "C" , the first letter ,
not the first word.
any
I want to install vim plugins with ansible shell module
the task is quite simple as follow
- name: install vim vundle plugin
> shell: "vim +PluginInstall +qall"
>
but the playbook will hang at this task like forever.
even with -vv or -vvv , there`s no more detail log , it just hangs !
any
I have a yml file named: client_hosts.yml
it looks like below
client_hosts:
> abc.com:
> - host: dc021
> ipv4: 192.168.11.21
> - host: dc022
> ipv4: 192.168.11.22
> - host: dc023
> ipv4: 192.168.11.23
> iuser: True
> user: john
> - host: dc024
> ipv4:
>
>
> tags:
> - env
> include_vars:
> file: files/teams.yml
> name: teams
>
> - name: debug
> tags:
> - env
> debug:
> msg: "{{ ite
I have a task , want to do something when a specified database is not in
postgresql using command "psql --list"
- name: check if db exists
tags:
¦ - checkdbexists
¦ - test
command: "psql --list"
register: dbexists
- name: debug dbexist
tags:
¦- test
¦- debug
>
>
> thanks for reply
>
what if I want to use value in here
"item": {
"dhome": "/home/ccw/D",
"name": "ccw",
"nb": "dc078.abc.com",
"neohome": "/home/ccw/D/eus",
"ws": "qs054.abc.com"
I try
I wrote a easy playbook to been called when devops do a git push with
webhook.
if Devs do a git push , webhook will notify my ansible server to run a
script which run anisble-playbook myplaybook -i inventory_name -vvv | tee
-a /tmp/myplaybook_result.log
but the log file only contain the
20 matches
Mail list logo