Skip to content
Snippets Groups Projects
Commit 4af92490 authored by Chris Hines's avatar Chris Hines
Browse files

ansible role to move homedirs for ec2-user to /localhome. The userdata script...

ansible role to move homedirs for ec2-user to /localhome. The userdata script doesn't work on certain configs of cloud-init
parent 1aeecbd5
No related branches found
No related tags found
No related merge requests found
- name: make /local_home
file: path=/local_home owner=root group=root state=directory
sudo: true
- name: copy the {{ ansible_ssh_user }} home
shell: cp -ar /home/{{ ansible_ssh_user }} /local_home
ignore_errors: true
sudo: true
register: home_copied
- name: edit passwd file
lineinfile:
args:
dest: /etc/passwd
regexp: "{{ ansible_ssh_user }}:x:1001:1001::/home/{{ ansible_ssh_user }}:.*"
line: "{{ ansible_ssh_user }}:x:1001:1001::/local_home/{{ ansible_ssh_user }}:/bin/bash"
backrefs: yes
sudo: true
register: edit1
- name: edit passwd file
lineinfile:
args:
dest: /etc/passwd
regexp: "{{ ansible_ssh_user }}:x:500:500::/home/{{ ansible_ssh_user }}:.*"
line: "{{ ansible_ssh_user }}:x:500:500::/local_home/{{ ansible_ssh_user }}:/bin/bash"
backrefs: yes
sudo: true
register: edit2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment