LearnLinuxTV / personal_ansible_desktop_configs

317 stars 98 forks source link

Group ansible does not exist #2

Closed aguerrave closed 2 years ago

aguerrave commented 3 years ago

Hi, I'm trying to use your skeleton to configure my personal ansible, but I can't figure out how to correct this error? fatal: [localhost]: FAILED! => {"changed": false, "msg": "Group ansible does not exist"} Another question: the role for laptops vs workstation, What is the most different. Or you use the same. Regards.

borcean commented 3 years ago

Please give more context to the error you are getting. At a minimum give the whole task that failed so we can see the name, like so:

TASK [base : ansible setup | ansible systemd timers] ****************************************************************************
ok: [neon.borcean.xyz] => (item={'key': 'refresh', 'value': {'timer_boot': '1m', 'timer_active': '1d'}})
ok: [neon.borcean.xyz] => (item={'key': 'pull', 'value': {'timer_boot': '10m', 'timer_active': '1h'}})

Based on what you have posted I am assuming its base: ansible setup | create ansible log file. If so the ansible group simply does not exist on your system. Jay likely creates that group before ansible is run for the first time using some script that seeds his setup.

I have forked and adapted Jay's repo to fit my own needs, you may want to take a look and see if it gives you some ideas 🙂

With respect to "laptops vs workstation" I think of every PC, be it a laptop or desktop, as a workstation. For all PCs I want the workstation role run, but on my laptop I also run a second role called thinkpad that configures power settings, etc. See the hosts file.

aguerrave commented 3 years ago

Hi, thank for response. In the roles->task->users->jay.yml

- name: users | jay | create user
  tags: jay,sudo,users
  user:
    name: jay
    group: jay
    **groups: adm,ansible,{{ sudo_group }}**
    state: present
    comment: "Jay LaCroix"
    password: "{{ jay_passwd }}"
    shell: /bin/bash

Regards

LearnLinuxTV commented 2 years ago

I think I remember something about this, I think it was a race condition where the group is being referred to before the group was actually created. Usually this is just a matter of making sure the play that created the group is called before the group itself is called. Let me know if you still have any trouble with this.