Playbook for Linux Users - SomethingGeneric/sparkle.local GitHub Wiki

Run Linux passwordless SSH commands

Make sure you re-run these commands everytime you come back to your machine!

eval $(ssh-agent)
ssh-add -t 14400

Make the playbook

  • make linux_users.yml file in the ansible directory

image

  • use your favorite text editor to make your playbook!
---
- name: Create a Linux Local User
  hosts: linux
  become: yes
  tasks:
  - name: Add user sparkle-gremlin
    user:
      name: sparkle-gremlin
      password: "{{ 'password' | password_hash('sha512') }}"
      shell: /bin/bash
      home: /home/sparkle-gremlin

Link to playbook above

Run the playbook

  • ansible-playbook -u sparkle-deployer -i linux_hosts.txt linux_user.yml
    • I am running this command form the sparkle user account so using the u command allows me to specify that I want the playbook to run with the sparkle-deployer account.
    • the -i flag lets you tell ansible which inventory file you will be using.

image

SSH into new accounts on the linux machines!

docker-sparkle

  • ssh sparkle-gremlin@docker-sparkle

image

util-sparkle

  • ssh sparkle-gremlin@util-sparkle

image

dhcp1-razzle

  • ssh sparkle-gremlin@dchp1-razzle

image

dhcp2-dazzle

  • ssh sparkle-gremlin@dchp2-dazzle

image