From b349ec77e962a86ba54ff56c29b21c1082e32d95 Mon Sep 17 00:00:00 2001 From: David Lopez Date: Thu, 20 Jul 2023 19:40:11 +0000 Subject: [PATCH] Actualizar 'playbooks/create_user_ssh/main.yml' --- playbooks/create_user_ssh/main.yml | 50 +++++++----------------------- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/playbooks/create_user_ssh/main.yml b/playbooks/create_user_ssh/main.yml index 17e3538..10ff1f4 100644 --- a/playbooks/create_user_ssh/main.yml +++ b/playbooks/create_user_ssh/main.yml @@ -1,40 +1,14 @@ --- -- name: Add user | Debian based OS - user: - name: "{{ username }}" - groups: sudo,shadow - shell: /bin/bash - append: yes - generate_ssh_key: yes - ssh_key_bits: 4096 - ssh_key_file: .ssh/id_rsa - when: ansible_os_family == "Debian" +- name: Install WordPress, MySQL, Nginx, and PHP-FPM + hosts: all + remote_user: root + # remote_user: user + # become: yes + # become_method: sudo -- name: Add user | Redhat based OS - user: - name: "{{ username }}" - groups: wheel - shell: /bin/bash - append: yes - generate_ssh_key: yes - ssh_key_bits: 4096 - ssh_key_file: .ssh/id_rsa - when: ansible_os_family == "RedHat" - -- name: Sudo | add to sudoers file and validate - lineinfile: - dest: /etc/sudoers - state: present - regexp: '^{{ username }} ' -# line: '{{username}} ALL=(ALL) NOPASSWD:ALL' - line: "{{ username }} ALL=(ALL) {{ 'NOPASSWD:' if ( default_sudo_nopass|d(true)|bool ) else '' }}ALL" - validate: 'visudo -cf %s' - environment: - PATH: /usr/sbin:/usr/local/sbin:/sbin -#environment fixes Redhat issue of hard-coded path to visudo - -- name: SSH Keys | Add authorized key for ssh key authentication - authorized_key: - user: "{{ username }}" - state: present - key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}" \ No newline at end of file + roles: + - common + - mysql + - nginx + - php-fpm + - wordpress