Created
May 29, 2023 20:18
-
-
Save VFS/8a6ef2c5940543a336506f69c6fe9f79 to your computer and use it in GitHub Desktop.
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: aws_free_tier | |
| # https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Dependencies | |
| # https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings | |
| vars: | |
| model_types: | |
| - name: checkpoint | |
| required_folder: Stable-diffusion | |
| - name: lora | |
| required_folder: lora | |
| - name: lycoris | |
| required_folder: lora | |
| tasks: | |
| - name: Ping my hosts | |
| ansible.builtin.ping: | |
| - name: Update and upgrade apt packages | |
| become: true | |
| ansible.builtin.apt: | |
| upgrade: yes # If yes or safe, performs an aptitude safe-upgrade. | |
| update_cache: yes # Run the equivalent of apt-get update before the operation. Can be run as part of the package installation or as a separate step. Default is not to update the cache. | |
| cache_valid_time: 86400 # One day. Update the apt cache if it is older than the cache_valid_time. This option is set in seconds. | |
| - name: Install required packages | |
| become: true | |
| ansible.builtin.apt: | |
| pkg: | |
| - wget | |
| - git | |
| - python3 | |
| - python3-pip | |
| - python3-venv | |
| - tree | |
| - nginx | |
| - gcc | |
| - libgl1 # ImportError: libGL.so.1: cannot open shared object file: No such file or directory | |
| - libtcmalloc-minimal4 # Cannot locate TCMalloc (improves CPU memory usage) https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/10117 | |
| - google-perftools # Cannot locate TCMalloc (improves CPU memory usage) https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/10117 | |
| - name: Create /opt/app directory | |
| become: true | |
| file: | |
| path: /opt/app | |
| state: directory | |
| owner: ubuntu | |
| group: ubuntu | |
| mode: 0775 | |
| - name: Create /opt/models directory | |
| # Remember to change the default model folder for webui.sh with --ckpt-dir /opt/models | |
| # symlinking files is not supported https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/7873 | |
| become: true | |
| file: | |
| path: /opt/models/{{ item.required_folder }} | |
| state: directory | |
| owner: ubuntu | |
| group: ubuntu | |
| mode: 0775 | |
| loop: "{{ model_types }}" | |
| - name: Clone AUTOMATIC1111/stable-diffusion-webui to /opt/app | |
| ansible.builtin.git: | |
| repo: https://github.com/AUTOMATIC1111/stable-diffusion-webui.git | |
| dest: /opt/app | |
| - name: Create /opt/models directory | |
| become: true | |
| file: | |
| path: /opt/app | |
| state: directory | |
| owner: ubuntu | |
| group: ubuntu | |
| mode: 0775 | |
| - name: start nginx | |
| become: true | |
| service: | |
| name: nginx | |
| state: started | |
| - name: copy the nginx config file to sites-available | |
| become: yes | |
| copy: | |
| src: ./nginx/proxy_webui.cfg | |
| dest: /etc/nginx/sites-available/static_site.cfg | |
| - name: copy the nginx config file to sites-available | |
| # htpasswd -c htpasswd admin; nenhumsegredo | |
| become: yes | |
| copy: | |
| src: ./nginx/htpasswd | |
| dest: /etc/nginx/htpasswd | |
| - name: create symlink on sites-enabled | |
| become: yes | |
| file: | |
| src: /etc/nginx/sites-available/static_site.cfg | |
| dest: /etc/nginx/sites-enabled/default | |
| state: link | |
| - name: restart nginx | |
| become: true | |
| service: | |
| name: nginx | |
| state: restarted | |
| - hosts: aws_free_tier | |
| vars: | |
| ansible_become: yes | |
| roles: | |
| # https://galaxy.ansible.com/nvidia/nvidia_driver | |
| - nvidia.nvidia_driver |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment