On 2/4/20 8:56 PM, Azir Guleroglu wrote: > Hello, > > I try to automate MongoDB installation with Ansible, but i can't create a > replica set members automatically. > > I want to get automatically 3 host's hostnames and add to members. I tried to > use setup module and with ansible_hostname > and registered to variables but I failed. > > Thanks in advance
Hello Azir,
it is unclear to me where these hostnames are coming from. And as far as I know
you can only register one variable with
register:
Regards
Racke
>
> - name: get hostname
> setup:
> filter: ansible_hostname
> - name: debug
> debug:
> var: ansible_hostname
> register: mongodb1, mongodb2, mongodb3
>
> - name: replica set
> mongodb_replicaset:
> login_host: localhost
> login_user: admin
> login_password: test
> replica_set: rs0
> members:
> - {{ mongodb1 }}:27017
> - {{ mongodb2 }}:27017
> - {{ mongodb3 }}:27017
> when: groups.mongod.index(inventory_hostname) == 0
>
>
>
> --
> 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
> [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ad763356-5108-4bea-9f24-239fd2255812%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/ad763356-5108-4bea-9f24-239fd2255812%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/281c38db-3db7-4dc8-649d-eb61dbfd3198%40linuxia.de.
signature.asc
Description: OpenPGP digital signature
