GithubHelp home page GithubHelp logo

ansible-user's Introduction

Roles: ansible-user

  • Playbook para adicionar e gerenciar usuarios no Linux

Sistema Operacional

  • Familia Red Hat

Pre-requesitos

  • Gerando senha criptografada
$ openssl passwd -1
  • Gerando chaves ssh-key por usuario
$ ssh-keygen -t rsa -b 2048 -v -f keyname

Inventario

  • Arquivo de inventario para adicionar novos hosts
[linux-hyperv]
localhost

Playbook: deploy-user.yml

---
- hosts: linux-servers
  become: true
  become_user: root
  gather_facts: false
  tasks:
    - name: Criando usuario remoto
      user:
       name: remoto
       comment: Usuario padrao de acesso remoto SSH
       groups: wheel
       shell: /bin/bash
       password: $1$2cn8rY.D$VBMDKK6JqViPMyjUNPIib/
      tags: user

    - name: Setando chave ssh key
      authorized_key:
       user: remoto
       state: present
       key: "{{ lookup('file', 'remoto.pub') }}"
      tags: ssh-key

    - name: Copiando file sudoers
      copy:
       src: sudoers
       dest: /etc/sudoers
       owner: root
       group: root
       mode: 0444
      tags: sudo

    - name: Padrinozando senha de root
      user:
       name: root
       password: $1$2cn8rY.D$VBMDKK6JqViPMyjUNPIib/
      tags: user

    - name: Setando chaves ssh key
      authorized_key:
       user: root
       state: present
       key: "{{ lookup('file', 'ansible.pub') }}"
      tags: ssh-key

Executando playbook:

ansible-playbook -i inventory deploy-user.yml -k  -u root

Autor:

ansible-user's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.