--- - name: Validate fdamstra user ansible.builtin.user: name: fdamstra state: present comment: Fred Damstra shell: /bin/bash append: yes # add groups, not replace groups: - sudo home: /home/fdamstra password: "{{ password }}" update_password: on_create - name: Create authorized key authorized_key: user: fdamstra state: present key: "{{ public_ssh_key }}" - name: Set nopassword for sudo group lineinfile: path: /etc/sudoers.d/20-sudo-group-nopasswd line: '%sudo ALL=(ALL) NOPASSWD: ALL' state: present mode: 0440 create: yes validate: 'visudo -cf %s' - name: Install public key copy: dest: /home/fdamstra/.ssh/id_ed25519.pub content: "{{ public_ssh_key }}" mode: 0644 owner: fdamstra - name: Install private key copy: dest: /home/fdamstra/.ssh/id_ed25519 content: "{{ private_ssh_key }}" mode: 0600 owner: fdamstra - name: Set up Environment become: yes become_user: fdamstra git: repo: ssh://git@git.monkeybox.org:2222/fdamstra/MyEnvironment.git dest: /home/fdamstra/MyEnvironment accept_hostkey: yes register: git_myenvironment when: skip_git == False - name: Create Environment Links become: yes become_user: fdamstra command: chdir: /home/fdamstra/MyEnvironment cmd: ./CreateLinks.sh when: skip_git == False and git_myenvironment.changed - name: Remove Ubuntu user ansible.builtin.user: name: ubuntu state: absent - name: Git Email community.general.git_config: name: user.email scope: global value: 'fred.damstra@gmail.com' - name: Git Name community.general.git_config: name: user.email scope: global value: 'fred.damstra@gmail.com [{{ inventory_hostname }}'