File tree 22 files changed +218
-131
lines changed
22 files changed +218
-131
lines changed Original file line number Diff line number Diff line change @@ -1656,3 +1656,5 @@ mageops_public_ip_v4_api_url: "{{ aws_use | ternary('http://169.254.169.254/late
1656
1656
1657
1657
1658
1658
1659
+ mageops_unison_server_port : 5566
1660
+
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ unison_project_name : " {{ mageops_project }}"
2
+ unison_project_slug : " {{ unison_project_name | trim | lower | regex_replace('[^a-z0-9]+', '_') }}"
3
+
4
+ unison_server_port : " {{ mageops_unison_server_port | default(5566) }}"
5
+ unison_server_address : " {{ hostvars[groups['vagrant'][0]]['ansible_host'] }}"
6
+
7
+ # Skip installation, just set up the project configuration
8
+ unison_project_skip_install : no
9
+
10
+ unison_project_local_path : " {{ playbook_dir }}/../projects/{{ unison_project_name }}"
11
+ unison_project_remote_path : " /{{ unison_project_name }}"
12
+
13
+ unison_project_config_dir : ~/.unison
14
+ unison_project_config_path : " {{ unison_project_config_dir }}/{{ unison_project_name }}.prf"
15
+
16
+ unison_project_ignore_names :
17
+ - " .idea"
18
+ - " .history"
19
+ - " .DS_Store"
20
+ - " ._.DS_Store"
21
+ - " node_modules"
22
+ - " .php_cs.cache"
23
+ - " .tmp"
24
+ - " *.log"
25
+
26
+ unison_project_ignore_paths :
27
+ - " var/cache"
28
+ - " var/view_preprocessed"
29
+ - " var/log"
Original file line number Diff line number Diff line change
1
+ dependencies :
2
+ - role : cs.unison
3
+ when : not unison_project_skip_install | default(False)
Original file line number Diff line number Diff line change
1
+ - name : Create unison config dir
2
+ file :
3
+ path : " {{ unison_project_config_dir }}"
4
+ state : directory
5
+
6
+ - name : Ensure local project dir exsits
7
+ file :
8
+ path : " {{ unison_project_local_path }}"
9
+ state : directory
10
+
11
+ - name : Create unison profile
12
+ template :
13
+ src : project.prf
14
+ dest : " {{ unison_project_config_path }}"
15
+
Original file line number Diff line number Diff line change
1
+ root={{ unison_project_local_path | realpath }}
2
+ root=socket://{{ unison_server_address }}:{{ unison_server_port }}{{ unison_project_remote_path }}
3
+ label=Autoconfig for raccoon project {{ unison_project_name }}
4
+
5
+ auto=true
6
+ batch=true
7
+ fastcheck=default
8
+ retry=3
9
+
10
+
11
+ group=false
12
+ owner=false
13
+ dontchmod=false
14
+ perms=777
15
+ prefer={{ unison_project_local_path | realpath }}
16
+ silent=false
17
+ repeat=watch
18
+ stream=true
19
+
20
+ ignoreinodenumbers=true
21
+ ignorelocks=true
22
+
23
+ ignore = Name {{ '{' }}{{ unison_project_ignore_names | join(',') }}{{ '}' }}
24
+ ignore = Path {{ '{' }}{{ unison_project_ignore_paths | join(',') }}{{ '}' }}
25
+
Original file line number Diff line number Diff line change
1
+ unison_project_name : " {{ mageops_project }}"
2
+
3
+ unison_server_port : " {{ mageops_unison_server_port | default(5566) }}"
4
+
5
+ unison_server_version : 2.48.4
6
+ unison_server_tarball_url : " http://www.cis.upenn.edu/~bcpierce/unison/download/releases/unison-{{ unison_server_version }}/unison-{{ unison_server_version }}.tar.gz"
7
+
8
+ unison_server_user_create : yes
9
+ unison_server_user : " {{ magento_user }}"
10
+ unison_server_group : " {{ magento_group }}"
11
+
12
+ unison_server_working_dir : " {{ mageops_app_web_dir }}"
13
+ unison_server_project_dir : " {{ unison_server_working_dir }}/{{ unison_project_name }}"
14
+
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ dependencies :
2
+ - cs.unison
Original file line number Diff line number Diff line change
1
+ - name : Create user
2
+ when : unison_server_user_create
3
+ user :
4
+ name : " {{ unison_server_user }}"
5
+ state : present
6
+
7
+ - name : Ensure directories exist
8
+ file :
9
+ dest : " {{ item }}"
10
+ state : directory
11
+ mode : 0775
12
+ owner : " {{ unison_server_user }}"
13
+ group : " {{ unison_server_group }}"
14
+ with_items :
15
+ - " {{ unison_server_working_dir }}"
16
+ - " {{ unison_server_project_dir }}"
17
+
18
+ - name : Install unison service file
19
+ template :
20
+ src : unison.service
21
+ dest : /etc/systemd/system
22
+ notify : restart unison
23
+
24
+ - name : Start and enable unison
25
+ service :
26
+ name : unison
27
+ state : started
28
+ enabled : yes
Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ After=network.target
4
4
5
5
[Service]
6
6
Type =simple
7
- ExecStart =/usr/bin/unison -socket {{ unison_port }} -perms 0 -dontchmod true
7
+ ExecStart =/usr/bin/unison -socket {{ unison_server_port }} -perms 0 -dontchmod true
8
8
Restart =always
9
9
RestartSec =1
10
10
StandardOutput =syslog
11
11
StandardError =syslog
12
12
SyslogIdentifier =unison
13
- User ={{ unison_user }}
14
- Group ={{ unison_group }}
15
- WorkingDirectory ={{ unison_guest_working_dir }}
13
+ User ={{ unison_server_user }}
14
+ Group ={{ unison_server_group }}
15
+ WorkingDirectory ={{ unison_server_working_dir }}
16
16
UMask =002
17
17
18
18
[Install]
Original file line number Diff line number Diff line change
1
+ unison_macos_brew_package : unison
2
+ unison_macos_brew_package_fsmonitor : autozimu/homebrew-formulas/unison-fsmonitor
3
+ unison_linux_inotify_max_user_watches : 1000000
Original file line number Diff line number Diff line change
1
+ dependencies :
2
+ - role : cs.repo-mageops
3
+ when : ansible_distribution | lower == 'centos'
Original file line number Diff line number Diff line change
1
+ - name : <CentOS> Increase max inotify watches for unison
2
+ sysctl :
3
+ name : fs.inotify.max_user_watches
4
+ value : " {{ unison_linux_inotify_max_user_watches | string }}"
5
+ reload : yes
6
+ state : present
7
+
8
+ - name : <CentOS> Make sure conflicting packages are absent
9
+ yum :
10
+ name : unison
11
+ state : absent
12
+
13
+ - name : <CentOS> Install latest unison version from MageOps RPM repo
14
+ yum :
15
+ name : unison-static
16
+ state : latest
17
+ enablerepo : mageops
Original file line number Diff line number Diff line change
1
+ - name : <macOS> Check if homebrew package manager is present
2
+ command : brew config
3
+ failed_when : no
4
+ register : unison_brew_config_command
5
+
6
+ - name : <macOS> Warn user about being unable to install
7
+ when : unison_brew_config_command is failed
8
+ fail :
9
+ msg : |
10
+
11
+ ====================================================================
12
+ = WARNING! Unison will NOT be installed! =
13
+ ====================================================================
14
+
15
+ Automated installation on macOS requires that you have a functional
16
+ homebrew package manager installed.
17
+
18
+ Please go to https://brew.sh/ and follow the setup instructions.
19
+
20
+ Once you're done you can retry running this action or install them
21
+ manually:
22
+
23
+ $ brew install {{ unison_macos_brew_package_fsmonitor }} {{ unison_macos_brew_package }}
24
+
25
+ - name : <macOS> Install unison using homebrew
26
+ when : unison_brew_config_command is success
27
+ homebrew :
28
+ state : present
29
+ name :
30
+ - " {{ unison_macos_brew_package }}"
31
+ - " {{ unison_macos_brew_package_fsmonitor }}"
32
+ install_options :
33
+ - --force
34
+ - --force-bottle
35
+
36
+ # Homebrew module doesn't allow specifying link options
37
+ - name : <macOS> Make sure unison binaries are linked properly
38
+ when : unison_brew_config_command is success
39
+ command : >-
40
+ brew link --overwrite
41
+ {{ unison_macos_brew_package }}
42
+ {{ unison_macos_brew_package_fsmonitor }}
43
+
44
+
Original file line number Diff line number Diff line change
1
+ - name : Fail with warning about unspported OS
2
+ when : ansible_distribution | lower not in ['macosx', 'centos']
3
+ fail :
4
+ msg : |
5
+
6
+ ====================================================================
7
+ = WARNING! Unison will not be installed! =
8
+ ====================================================================
9
+
10
+ Automated installation is supported only on macOS and CentOS and your
11
+ system has been identified as: {{ ansible_distribution }}
12
+
13
+ You will have to install unison and fsmonitor manually yourself
14
+ to get continous file sync.
15
+
16
+ - name : Install unison client for macOS
17
+ import_tasks : install-macos.yml
18
+ when : ansible_distribution | lower == 'macosx'
19
+
20
+ - name : Install unison client for CentOS
21
+ import_tasks : install-centos.yml
22
+ when : ansible_distribution | lower == 'centos'
23
+
Original file line number Diff line number Diff line change 1
- # Run this playbook with --ask-sudo-pass
2
- - hosts : " all "
1
+ # Best run this playbook with --ask-sudo-pass
2
+ - hosts : vagrant
3
3
become : yes
4
+ gather_facts : yes
4
5
roles :
5
- - role : cs.unison-guest
6
+ - role : cs.unison-server
6
7
7
8
- hosts : localhost
8
9
connection : local
9
10
gather_facts : yes
10
11
roles :
11
- - role : cs.unison-host
12
+ - role : cs.unison-project
Original file line number Diff line number Diff line change 14
14
- role : cs.vagrant-sudo
15
15
- role : geerlingguy.composer
16
16
- role : cs.nodejs
17
+ - role : cs.unison-server
17
18
- role : cs.authorize-local-keys
18
19
authorize_local_keys_for_users :
19
20
- root
You can’t perform that action at this time.
0 commit comments