stuff
This commit is contained in:
parent
47baa9d238
commit
83fa331ae4
8 changed files with 359 additions and 7 deletions
33
ansible/services/personal-blog/setup_deploy_alias_lapy.yml
Normal file
33
ansible/services/personal-blog/setup_deploy_alias_lapy.yml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
- name: Configure deployment alias for personal blog in lapy .bashrc
|
||||
hosts: lapy
|
||||
gather_facts: no
|
||||
vars_files:
|
||||
- ../../infra_vars.yml
|
||||
- ./personal_blog_vars.yml
|
||||
vars:
|
||||
bashrc_path: "{{ lookup('env', 'HOME') }}/.bashrc"
|
||||
alias_line: "alias {{ deploy_alias_name }}='scp -r {{ local_source_dir }}/* {{ remote_user }}@{{ remote_host }}:/tmp/blog-deploy/ && ssh {{ remote_user }}@{{ remote_host }} \"sudo rm -rf {{ personal_blog_web_root }}/* && sudo cp -r /tmp/blog-deploy/* {{ personal_blog_web_root }}/ && sudo rm -rf /tmp/blog-deploy && sudo chown -R {{ remote_user }}:www-data {{ personal_blog_web_root }} && sudo find {{ personal_blog_web_root }} -type d -exec chmod 2775 {} \\; && sudo find {{ personal_blog_web_root }} -type f -exec chmod 664 {} \\;\"'"
|
||||
|
||||
tasks:
|
||||
- name: Remove any existing deployment alias from .bashrc (to avoid duplicates)
|
||||
lineinfile:
|
||||
path: "{{ bashrc_path }}"
|
||||
regexp: "^alias {{ deploy_alias_name }}="
|
||||
state: absent
|
||||
backup: yes
|
||||
|
||||
- name: Add or update deployment alias in .bashrc
|
||||
lineinfile:
|
||||
path: "{{ bashrc_path }}"
|
||||
line: "{{ alias_line }}"
|
||||
backup: yes
|
||||
insertafter: EOF
|
||||
|
||||
- name: Display deployment alias information
|
||||
debug:
|
||||
msg:
|
||||
- "Deployment alias '{{ deploy_alias_name }}' has been configured in {{ bashrc_path }}"
|
||||
- "Usage: {{ deploy_alias_name }}"
|
||||
- "This will scp {{ local_source_dir }}/* to {{ remote_user }}@{{ remote_host }}:{{ personal_blog_web_root }}/"
|
||||
- "Note: You may need to run 'source ~/.bashrc' or open a new terminal to use the alias"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue