diff --git a/all.yml b/all.yml index 22eb4d7..e2bb27d 100644 --- a/all.yml +++ b/all.yml @@ -24,3 +24,5 @@ tags: ["docker", "web"] - role: "gitea" tags: ["docker", "gitea"] + - role: "nextcloud" + tags: ["nextcloud", "gitea"] diff --git a/inv/host_vars/new.chosto.me/secrets.yml b/inv/host_vars/new.chosto.me/secrets.yml index eac3679..8425b8a 100644 --- a/inv/host_vars/new.chosto.me/secrets.yml +++ b/inv/host_vars/new.chosto.me/secrets.yml @@ -1,22 +1,30 @@ $ANSIBLE_VAULT;1.1;AES256 -62393336373634306239663131626365326563313035353232363839373664613363393061326136 -3164613334343462636263363233386236306132353766610a653036303738646363653837323934 -31653132653230616236366162613662623664643965323762613939396265616231643065373265 -3762666535353531390a303664653334396634643264393838323334373062356161353764363332 -64336365383639643464376131323164383062613734623134616337663735386334613063376236 -65346331373639366537333239373638336262613239356334613162623363363334353665353433 -65636461663965623463326161333534333265666435653063623761626130303332633636373131 -38383634366638636435363362303066623664663037393261376666313439356362663164613762 -64616239336464333364386665626230356637333761616535336361333935663837656664333864 -32646430653531326431333832316633343435633534316139336636626338616265663036656635 -65626330326438383964646130616639626533313436613835663762663932633230353862336364 -33636130336434623838646436383861656361353832663534366533383133323433376161396336 -30666564633366373063613664643766346137666361613836376361373432623364613264343765 -37356432383764343131393737653437383637626237653931626665333839373938323139363665 -35396336363330313334373139383963633432336530386564626562646163353465366166626631 -30353164646531326634363965353739386362626364666565376262613330643132323334613966 -64326463393633633563633139313033636132336161303730646232656139363966613137643633 -62663562356332613536386337363362643839373038313463613631656335623664393563346635 -63663533356131363335383961376662613738326264333030373239643530613637393866656265 -64656130663563613236323734613737353838306134333830346365363635656264393536383332 -3132 +32623335343331343131646165313031333361363864396334303961373133633337376638326363 +3135306436633631386361623766626239663839343831340a346566633339666133353765313838 +65643931626663643233306330336133373335326536376664323263336336396633316431393963 +3263306663383437320a643062616435326531663161393938313639383364386331383134376234 +66343365663032666434653861346265376131313864363665386633306263663937386331663633 +34613566646133316631323961363631643666643163356361393933353661643934626266353633 +35656430323363633961323230373230663664376339373965353761623163383934356532356633 +65633765613436353766386666363139353838663963643764623232363432636363373765376363 +35313930626366613661663263356232303933616131313666326339616633383165656136653434 +61616564643638366534326238333134623234333562636161343730396531663131636166303663 +36323333383531393435666431386431353638346437633130363730656433663031346362653339 +66623066383234623364653861633231316137353636623761346132373937653638376139643132 +66656263383131333233373631666462663266343462336634643532633638306462323166303161 +33643962363939313131666133393637636161393436336436613162376332386636653361393638 +65313932363433616564646138393465316137663937613037656663376330373136323032643032 +62626534376633393034613839336632666164363864366332366439313664343630336339633464 +35333232353061366463616232353430356131656633353866643062653531306162653463393039 +66663435343333383834306234316634656166333432306238306162613836303365643338633635 +34323235316231356230336466303032623235303930653439323236363533376437613363636163 +38666163383062303034653662343530333737316263666163656437343439663962353134313530 +38333034316432383330643966353030623637326334663330333530633534643662663835346465 +36663131363136396230653963393037313032333863353866663864643065383765306664333564 +38303861383636636434303038633835643934373439313438653761323165366430633165396537 +37633638393730653865313238393239393739366237353633366164393235393435313361343834 +34633233353037393138353664376330643965303666313138346333343935323531346631316563 +37306535643031623837396233366665306665626532356532386561356534653738333439646165 +65663131643162643061313266326638616531643063303361666464616166303263353561356462 +61343338343137323463353539643136313334646364313437663764653037633937373838613634 +3135 diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml new file mode 100644 index 0000000..7af508b --- /dev/null +++ b/roles/nextcloud/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- name: Create Nextcloud directory + file: + path: "{{ nextcloud_folder_name }}" + state: directory + owner: "{{ base_user_name }}" + group: "{{ base_user_name }}" + mode: 0755 + +- name: Copy Nextcloud Compose file + template: + src: docker-compose.yml.j2 + # Remove .j2 extension + dest: "{{ nextcloud_folder_name }}/docker-compose.yml" + owner: "{{ base_user_name }}" + group: "{{ base_user_name }}" + mode: 0644 + +- name: Ensure container is up to date + community.docker.docker_compose: + project_src: "{{ nextcloud_folder_name }}" + remove_orphans: yes + pull: yes + recreate: smart + state: present diff --git a/roles/nextcloud/templates/docker-compose.yml.j2 b/roles/nextcloud/templates/docker-compose.yml.j2 new file mode 100644 index 0000000..98620d1 --- /dev/null +++ b/roles/nextcloud/templates/docker-compose.yml.j2 @@ -0,0 +1,25 @@ +version: "{{ compose_version }}" + +networks: + proxy: + name: "{{ traefik_network }}" + +volumes: + nextcloud: + name: nextcloud + +services: + # Will use SQLite as this is a small instance + nextcloud: + image: "nextcloud:{{ nextcloud_version }}" + container_name: nextcloud + volumes: + - nextcloud:/var/www/html + labels: + traefik.http.routers.cloud.entrypoints: websecure + traefik.http.routers.cloud.rule: "Host(`cloud1.{{ domain_name }}`)" + traefik.http.services.cloud.loadbalancer.server.port: 80 + traefik.enable: true + networks: + - proxy + restart: unless-stopped diff --git a/roles/nextcloud/vars/main.yml b/roles/nextcloud/vars/main.yml new file mode 100644 index 0000000..6efd889 --- /dev/null +++ b/roles/nextcloud/vars/main.yml @@ -0,0 +1,2 @@ +nextcloud_version: 21 +nextcloud_folder_name: "{{ docker_files }}/nextcloud"