|
4 | 4 | name: |
5 | 5 | - unzip |
6 | 6 | state: present |
7 | | - |
8 | 7 | - name: Create rustfs user |
9 | 8 | ansible.builtin.user: |
10 | 9 | name: rustfs |
11 | 10 | system: true |
12 | 11 | shell: /bin/false |
13 | 12 | home: /opt/rustfs |
14 | 13 | create_home: true |
15 | | - |
16 | 14 | - name: Create data directory |
17 | 15 | ansible.builtin.file: |
18 | 16 | path: "{{ rustfs_data_dir }}" |
19 | 17 | state: directory |
20 | 18 | owner: rustfs |
21 | 19 | group: rustfs |
22 | 20 | mode: '0755' |
23 | | - |
24 | 21 | - name: Create rustfs log directory |
25 | 22 | ansible.builtin.file: |
26 | 23 | path: /var/log/rustfs |
27 | 24 | state: directory |
28 | 25 | owner: rustfs |
29 | 26 | group: rustfs |
30 | 27 | mode: '0755' |
31 | | - |
32 | 28 | - name: Create rustfs configuration directory |
33 | 29 | ansible.builtin.file: |
34 | 30 | path: /etc/rustfs |
35 | 31 | state: directory |
36 | 32 | owner: rustfs |
37 | 33 | group: rustfs |
38 | 34 | mode: '0755' |
39 | | - |
40 | 35 | - name: Create rustfs binary directory |
41 | 36 | ansible.builtin.file: |
42 | 37 | path: /opt/rustfs/bin |
43 | 38 | state: directory |
44 | 39 | owner: rustfs |
45 | 40 | group: rustfs |
46 | 41 | mode: '0755' |
47 | | - |
48 | 42 | - name: Download RustFS server archive |
49 | 43 | ansible.builtin.get_url: |
50 | 44 | url: "{{ rustfs_server_url }}" |
51 | 45 | dest: /tmp/rustfs-server.zip |
52 | 46 | mode: '0644' |
53 | 47 | notify: Restart rustfs |
54 | | - |
55 | 48 | - name: Extract RustFS server binary |
56 | 49 | ansible.builtin.unarchive: |
57 | 50 | src: /tmp/rustfs-server.zip |
|
60 | 53 | owner: rustfs |
61 | 54 | group: rustfs |
62 | 55 | mode: '0755' |
63 | | - |
64 | 56 | - name: Ensure rustfs binary is executable |
65 | 57 | ansible.builtin.file: |
66 | 58 | path: /opt/rustfs/bin/rustfs |
67 | 59 | owner: rustfs |
68 | 60 | group: rustfs |
69 | 61 | mode: '0755' |
70 | | - |
71 | 62 | - name: Download RustFS client archive |
72 | 63 | ansible.builtin.get_url: |
73 | 64 | url: "{{ rustfs_client_url }}" |
74 | 65 | dest: /tmp/rustfs-cli.tar.gz |
75 | 66 | mode: '0644' |
76 | | - |
77 | 67 | - name: Extract RustFS client binary |
78 | 68 | ansible.builtin.unarchive: |
79 | 69 | src: /tmp/rustfs-cli.tar.gz |
|
82 | 72 | owner: rustfs |
83 | 73 | group: rustfs |
84 | 74 | mode: '0755' |
85 | | - |
86 | 75 | - name: Create symlinks for rustfs binaries |
87 | 76 | ansible.builtin.file: |
88 | 77 | src: "/opt/rustfs/bin/{{ item }}" |
|
91 | 80 | loop: |
92 | 81 | - rustfs |
93 | 82 | - rc |
94 | | - |
95 | 83 | - name: Generate RustFS configuration |
96 | 84 | ansible.builtin.template: |
97 | 85 | src: rustfs.j2 |
|
100 | 88 | group: rustfs |
101 | 89 | mode: '0640' |
102 | 90 | notify: Restart rustfs |
103 | | - |
104 | 91 | - name: Create systemd service file |
105 | 92 | ansible.builtin.template: |
106 | 93 | src: rustfs.service.j2 |
|
111 | 98 | notify: |
112 | 99 | - Reload systemd |
113 | 100 | - Restart rustfs |
114 | | - |
115 | 101 | - name: Enable and start RustFS service |
116 | 102 | ansible.builtin.systemd: |
117 | 103 | name: rustfs |
118 | 104 | enabled: true |
119 | 105 | state: started |
120 | 106 | daemon_reload: true |
121 | | - |
122 | 107 | - name: Wait for RustFS API to be ready |
123 | 108 | ansible.builtin.wait_for: |
124 | 109 | port: "{{ rustfs_port }}" |
125 | 110 | host: "{{ ansible_facts['default_ipv4']['address'] }}" |
126 | 111 | delay: 10 |
127 | 112 | timeout: 60 |
128 | | - |
129 | 113 | - name: Wait for RustFS Console to be ready |
130 | 114 | ansible.builtin.wait_for: |
131 | 115 | port: "{{ rustfs_console_port }}" |
|
0 commit comments