Created
October 12, 2019 16:34
-
-
Save sechiro/315d6ef29bd58af1f6dd6b63dacbeac5 to your computer and use it in GitHub Desktop.
Amazon Linux 2で初期サーバにユーザ作成する手順
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo amazon-linux-extras install ansible2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sechiro ALL=(ALL) NOPASSWD: ALL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: localhost | |
tasks: | |
- name: Add sechiro user | |
become: yes | |
user: | |
name: sechiro | |
- name: Set authorized key taken from file | |
become: yes | |
become_user: sechiro | |
authorized_key: | |
user: sechiro | |
state: present | |
key: https://github.com/sechiro.keys | |
- name: Copy a new "sudoers" file into place, after passing validation with visudo | |
become: yes | |
copy: | |
src: sechiro_sudoers | |
dest: /etc/sudoers.d | |
validate: /usr/sbin/visudo -cf %s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment