aboutsummaryrefslogblamecommitdiffhomepage
path: root/tasks/setup.yml
blob: a2d5b900b875d5ae231eb5f030aa4f92375ad1e7 (plain) (tree)
1
2
3
4
5


                                                                
                     
                     








                                                          

                              
                                                       
                                                         
       
                                                               
                                                                                                       
                                                                                                 




                                                                    
              


                          
- name: Check if clever command is available in path and version
  command: clever --version
  register: clever_returned_version
  ignore_errors: true
  changed_when: False

- name: Ensure user path exists
  file:
    path: "{{ ansible_env.HOME }}/{{ clever_user_path }}"
    state: directory

- name: Download and install clever cli tools if necessary
  unarchive:
    remote_src: yes
    extra_opts:
      - "--strip-components=1"
    src: "{{ clever_repo }}/{{ clever_tools_archive }}"
    dest: "{{ ansible_env.HOME }}/{{ clever_user_path }}"
  vars:
    clever_repo: https://clever-tools.clever-cloud.com/releases
    clever_tools_archive: "{{ clever_cli_version }}/clever-tools-{{ clever_cli_version }}_linux.tar.gz"
  when: clever_returned_version is failed or clever_returned_version.stdout != clever_cli_version

- name: Install helper scripts
  copy:
    src: "{{ item }}"
    dest: "{{ ansible_env.HOME }}/{{ clever_user_path }}/{{ item }}"
    mode: 0755
  with_items:
    - clever-set-domain.sh
    - clever-set-drain.sh