Skip to content

Commit

Permalink
Merge pull request #434 from cradle8810/433_skylark_sudo_nopass
Browse files Browse the repository at this point in the history
Skylarkのsudoなしrsync(1)とbtrfs(8)の実行
  • Loading branch information
cradle8810 authored Jan 22, 2025
2 parents ead854b + 0ecedb9 commit 407490c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions skylark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
tags:
- backupscripts

- name: Sudo nopassword Settings
ansible.builtin.import_tasks:
file: tasks/skylark/sudo_nopass.yml
tags:
- sudo

- name: Make Started Services
ansible.builtin.import_tasks:
file: tasks/service_start.yml
10 changes: 10 additions & 0 deletions tasks/skylark/sudo_nopass.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: "Sudo password passthrough"
ansible.builtin.blockinfile:
path: "/etc/sudoers"
backup: true
insertafter: "EOF"
validate: "visudo -cf %s"
block: |
hayato ALL=(ALL:ALL) NOPASSWD: /usr/bin/rsync
hayato ALL=(ALL:ALL) NOPASSWD: /usr/bin/btrfs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ EXCLUDEFILE='{{ pathinfo.excludefilepath }}'
TODAY=$(date +%Y%m%d_%H%M%S)

# rsync
echo "rsync -av8 --delete --exclude-from=${EXCLUDEFILE} ${SRC} ${DEST}"
rsync -av8 --delete --exclude-from="${EXCLUDEFILE}" ${SRC} ${DEST}
echo "sudo rsync -av8 --delete --exclude-from=${EXCLUDEFILE} ${SRC} ${DEST}"
sudo rsync -av8 --delete --exclude-from="${EXCLUDEFILE}" ${SRC} ${DEST}
RETVAL=$?

# Snapshot 作成
Expand Down

0 comments on commit 407490c

Please sign in to comment.