diff --git a/defaults/disroot.yml b/defaults/disroot.yml index dcc4b83..05d33cf 100644 --- a/defaults/disroot.yml +++ b/defaults/disroot.yml @@ -1,13 +1,6 @@ --- -# Repos -## site_hostname: the main name of your website root, where you'll download pages, theme, etc. -## folder_name: whatever you want as a name for your repo/folder -## type: can be pages or theme. "pages" means that this repo will the main website, not a sub folder like theme -## repo: the url of your git repo. -## modules: list of modules you want to install with gpm. If no modules is to be set, add [], otherwise it throws an error - -grav_already_modules_installed: 'false' # set to true after 1st installation +grav_modules_already_installed: 'false' # set to true after 1st installation grav_website_repo: - site_hostname: disroot.lan @@ -18,9 +11,11 @@ grav_website_repo: - name: language-selector config: 'true' site_name: "Disroot" - theme_name: "disroot" + pages_folder: "" + system_file: "disroot.system.yaml" + site_file: "disroot.site.yaml" + - site_hostname: howto.disroot.lan - site_name: "Disroot Howto" repo: 'https://git.disroot.org/Disroot/Howto.git' modules: - name: themer @@ -32,17 +27,25 @@ grav_website_repo: config: 'true' - name: tagcloud site_name: "Disroot Howto" - theme_name: "grav-theme-howto" + pages_folder: "" + system_file: "howto.system.yaml" + site_file: "howto.site.yaml" grav_website_theme: - site_hostname: disroot.lan theme_name: disroot + folder_name: theme + subfolder_path: "/" repo: 'https://git.disroot.org/Disroot-themes/grav-theme-disroot.git' - site_hostname: howto.disroot.lan theme_name: grav-theme-howto + folder_name: theme + subfolder_path: "/" repo: 'https://git.disroot.org/Disroot-themes/grav-theme-howto.git' - site_hostname: disroot.lan theme_name: disrootblog + subfolder_path: "/" + folder_name: blogtheme repo: 'https://git.disroot.org/Disroot-themes/grav-theme-disrootblog.git' grav_website_specific_pages: diff --git a/defaults/main.yml b/defaults/main.yml index c70d98a..45c7b03 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,7 @@ --- +grav_modules_already_installed: 'false' # set to true after 1st installation so that it doesn't install plugins again + grav_pkg: - dialog - ca-certificates @@ -14,35 +16,31 @@ grav_version: '1.7.41.1' grav_download_url: 'https://github.com/getgrav/grav/releases/download/{{ grav_version }}/grav-v{{ grav_version }}.zip' # Repos -## site_hostname: the main name of your website root, where you'll download pages, theme, etc. -## folder_name: whatever you want as a name for your repo/folder -## type: can be pages or theme. "pages" means that this repo will the main website, not a sub folder like theme -## repo: the url of your git repo. -## modules: list of modules you want to install with gpm. If no modules is to be set, add [], otherwise it throws an error - -grav_modules_already_installed: 'false' # set to true after 1st installation - # If you have a git repo with your pages you can set it with the following: grav_website_repo: - - site_hostname: mywebsite.lan - #repo: - modules: + - site_hostname: mywebsite.lan # the main name of your website root, where you'll download pages, theme, etc. + #repo: "" # the url of your git repo. + modules: # list of modules you want to install with gpm. If no modules is to be set, add [], otherwise it throws an error - name: themer - name: language-selector config: 'true' site_name: "My Website" - theme_name: quark # the default is quark + pages_folder: "pages" # keep that empty if your repo files are in the `pages` folder. Otherwise, set it to `pages`. + # system_file: "mysite.system.yaml" # uncomment this if you want to deploy your own config file. Your yaml file has to be added in `files` folder. + # site_file: "mysite.site.yaml" # uncomment this if you want to deploy your own config file. Your yaml file has to be added in `files` folder. # If you have a repo with a theme you can set it with the following: grav_website_theme: -# - site_hostname: -# theme_name: -# repo: +# - site_hostname: # the name of your website's hostname +# folder_name: # the name you want to give to the git cloned folder +# subfolder_path: "/" # path to the folder that holds the files on your repo, if there aren't in your repo's root. Set it as "/" if your files are in root. +# theme_name: # the name you want to give to the theme +# repo: # the website repo # If you have other repos, for exemple specific pages, you can set those with the following: grav_website_specific_pages: # - site_hostname: -# folder_name: +# folder_name: # repo: # symlink_from_path: # symlink_to_path: diff --git a/templates/user/config/site.yaml.j2 b/files/disroot.site.yaml similarity index 84% rename from templates/user/config/site.yaml.j2 rename to files/disroot.site.yaml index b410058..e89bce5 100644 --- a/templates/user/config/site.yaml.j2 +++ b/files/disroot.site.yaml @@ -1,4 +1,4 @@ -title: {{ item.site_name }} +title: Disroot.lan default_lang: en author: name: Disroot diff --git a/templates/user/config/system.yaml.j2 b/files/disroot.system.yaml similarity index 98% rename from templates/user/config/system.yaml.j2 rename to files/disroot.system.yaml index 4a5c17a..af1ae15 100644 --- a/templates/user/config/system.yaml.j2 +++ b/files/disroot.system.yaml @@ -29,7 +29,7 @@ home: hide_in_urls: false pages: - theme: {{ item.theme_name }} + theme: disroot order: by: default dir: asc diff --git a/files/howto.site.yaml b/files/howto.site.yaml new file mode 100644 index 0000000..b70c87d --- /dev/null +++ b/files/howto.site.yaml @@ -0,0 +1,18 @@ +title: 'Howto Disroot' +default_lang: en +author: + name: 'Disroot Team' + email: info@disroot.org +taxonomies: + - category + - tag +metadata: + description: 'Howtos, tutorials to help you use services provided by disroot.org' +summary: + enabled: true + format: short + size: 300 + delimiter: '===' +blog: + route: /blog +acxtest: TEST \ No newline at end of file diff --git a/files/howto.system.yaml b/files/howto.system.yaml new file mode 100644 index 0000000..c53fcec --- /dev/null +++ b/files/howto.system.yaml @@ -0,0 +1,165 @@ +absolute_urls: false +param_sep: ':' +wrapped_site: false +reverse_proxy_setup: false +force_ssl: false +force_lowercase_urls: true +username_regex: '^[a-z0-9_-]{3,16}$' +pwd_regex: '(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}' +intl_enabled: true +languages: + supported: + - en + - pl + - es + - fr + - pt + - hu + - de + - ru + - it + - cs + include_default_lang: true + pages_fallback_only: false + translations: true + translations_fallback: true + session_store_active: true + http_accept_language: true + override_locale: false +home: + alias: /home + hide_in_urls: false +pages: + theme: 'grav-theme-howto' + order: + by: default + dir: asc + list: + count: 20 + dateformat: + short: 'jS M Y' + long: 'F jS \a\t g:ia' + publish_dates: true + process: + markdown: true + twig: false + twig_first: false + never_cache_twig: false + events: + page: true + twig: true + markdown: + extra: true + auto_line_breaks: false + auto_url_links: false + escape_markup: false + special_chars: + '>': gt + '<': lt + types: + - txt + - xml + - html + - htm + - json + - rss + - atom + expires: 604800 + last_modified: false + etag: false + vary_accept_encoding: false + redirect_default_route: false + redirect_default_code: '301' + redirect_trailing_slash: false + ignore_files: + - .DS_Store + ignore_folders: + - .git + - .idea + ignore_hidden: true + url_taxonomy_filters: true + frontmatter: + process_twig: false + ignore_fields: + - form + - forms +cache: + enabled: true + check: + method: file + driver: auto + prefix: g + purge_at: '0 4 * * *' + clear_at: '0 3 * * *' + clear_job_type: standard + clear_images_by_default: true + cli_compatibility: false + lifetime: 604800 + gzip: false + allow_webserver_gzip: false +twig: + cache: true + debug: true + auto_reload: true + autoescape: false + undefined_functions: true + undefined_filters: true + umask_fix: false +assets: + css_pipeline: false + css_pipeline_include_externals: true + css_pipeline_before_excludes: true + css_minify: true + css_minify_windows: false + css_rewrite: true + js_pipeline: false + js_pipeline_include_externals: true + js_pipeline_before_excludes: true + js_minify: true + enable_asset_timestamp: false + collections: + jquery: 'system://assets/jquery/jquery-2.x.min.js' +errors: + display: 0 + log: true +log: + handler: file + syslog: + facility: local6 +debugger: + enabled: false + shutdown: + close_connection: true + twig: true +images: + default_image_quality: 85 + cache_all: false + cache_perms: '0755' + debug: false + auto_fix_orientation: false + seofriendly: false +media: + enable_media_timestamp: false + auto_metadata_exif: false + upload_limit: 8388608 +session: + enabled: true + initialize: true + timeout: 1800 + name: grav-site + uniqueness: path + secure: false + httponly: true + split: true +gpm: + releases: stable + method: auto + verify_peer: true + official_gpm_only: true +accounts: + type: data + storage: file +strict_mode: + yaml_compat: true + twig_compat: true + blueprint_compat: true \ No newline at end of file diff --git a/tasks/configure.yml b/tasks/configure.yml index f103551..1ef2de6 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -1,13 +1,23 @@ --- - name: '[Config] - Deploy Grav system config file' - template: - src: 'user/config/system.yaml.j2' + copy: + src: '{{ item.system_file }}' dest: '{{ grav_path }}/{{ item.site_hostname }}/site/user/config/system.yaml' + owner: "{{ grav_user }}" + group: "{{ grav_group }}" + mode: '644' + when: item.system_file is defined loop: "{{ grav_website_repo }}" + tags: configure - name: '[Config] - Deploy Grav site config file' - template: - src: 'user/config/site.yaml.j2' + copy: + src: '{{ item.site_file }}' dest: '{{ grav_path }}/{{ item.site_hostname }}/site/user/config/site.yaml' + owner: "{{ grav_user }}" + group: "{{ grav_group }}" + mode: '644' + when: item.site_file is defined loop: "{{ grav_website_repo }}" + tags: configure diff --git a/tasks/main.yml b/tasks/main.yml index e317bce..80d68b1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,16 +8,30 @@ - name: "[GRAV] - Configure" include_tasks: configure.yml + when: configure.system_file is defined or configure.site_file is defined + loop: "{{ grav_website_repo }}" + loop_control: + loop_var: configure + tags: configure - name: "[GRAV] - Install modules" include_tasks: modules.yml - name: "[GRAV] - Deploy Website repos" include_tasks: website_repos.yml - when: item.repo is defined + when: website.repo is defined loop: "{{ grav_website_repo }}" + loop_control: + loop_var: website + tags: websites - name: "[GRAV] - Deploy Website sub repos" include_tasks: sub_repos.yml - when: item.repo is defined - loop: "{{ grav_website_repo }}" \ No newline at end of file + when: subrepo.repo is defined + loop: "{{ grav_website_repo }}" + loop_control: + loop_var: subrepo + tags: + - subrepos + - symlink + diff --git a/tasks/sub_repos.yml b/tasks/sub_repos.yml index 6b8460a..a6fe977 100644 --- a/tasks/sub_repos.yml +++ b/tasks/sub_repos.yml @@ -1,23 +1,40 @@ --- +- name: "[Repos] - Remove symlink theme path before git clone" + file: + path: "{{ grav_path }}/{{ item.site_hostname }}/{{ item.site_hostname }}-{{ item.folder_name }}" + state: absent + loop: "{{ grav_website_theme }}" + tags: subrepos + - name: "[Sub Repos] - Git clone Website theme repos" git: repo: "{{ item.repo }}" - dest: "{{ grav_path }}/{{ item.site_hostname }}/{{ item.site_hostname }}-{{ item.theme_name }}" + dest: "{{ grav_path }}/{{ item.site_hostname }}/{{ item.site_hostname }}-{{ item.folder_name }}" force: yes become: yes become_user: "{{ grav_user }}" loop: "{{ grav_website_theme }}" + tags: subrepos - name: "[Sub Repos] - Symlink theme path" file: - src: "{{ grav_path }}/{{ item.site_hostname }}/{{ item.site_hostname }}-{{ item.theme_name }}" + src: "{{ grav_path }}/{{ item.site_hostname }}/{{ item.site_hostname }}-{{ item.folder_name }}{{ item.subfolder_path }}" dest: "{{ grav_path }}/{{ item.site_hostname }}/site/user/themes/{{ item.theme_name }}" state: link owner: "{{ grav_user }}" group: "{{ grav_group }}" loop: "{{ grav_website_theme }}" + tags: + - subrepos + - symlink +- name: "[Repos] - Remove symlink specific pages path before git clone" + file: + path: "{{ grav_path }}/{{ item.site_hostname }}/{{ item.site_hostname }}-{{ item.folder_name }}" + state: absent + loop: "{{ grav_website_specific_pages }}" + tags: subrepos - name: "[Sub Repos] - Git clone Website specific pages repos" git: @@ -27,6 +44,7 @@ become: yes become_user: "{{ grav_user }}" loop: "{{ grav_website_specific_pages }}" + tags: subrepos - name: "[Sub Repos] - Symlink specific pages path" file: @@ -35,4 +53,8 @@ state: link owner: "{{ grav_user }}" group: "{{ grav_group }}" - loop: "{{ grav_website_specific_pages }}" \ No newline at end of file + loop: "{{ grav_website_specific_pages }}" + tags: + - subrepos + - symlink + diff --git a/tasks/website_repos.yml b/tasks/website_repos.yml index 0ecf9f9..e70c863 100644 --- a/tasks/website_repos.yml +++ b/tasks/website_repos.yml @@ -5,27 +5,38 @@ path: '{{ grav_path }}/{{ item.site_hostname }}/site/user/pages/02.typography/' state: absent loop: "{{ grav_website_repo }}" + tags: websites - name: '[Repos] - Remove the default 01.home/default.md file from new installation' file: path: '{{ grav_path }}/{{ item.site_hostname }}/site/user/pages/01.home/default.md' state: absent loop: "{{ grav_website_repo }}" + tags: websites + +- name: "[Repos] - Remove symlink pages path before git clone" + file: + path: "{{ grav_path }}/{{ item.site_hostname }}/site/user/pages" + state: absent + loop: "{{ grav_website_repo }}" + tags: websites - name: "[Repos] - Git clone Website repos" git: repo: "{{ item.repo }}" - dest: "{{ grav_path }}/{{ item.site_hostname }}/{{ item.site_hostname }}-pages" + dest: "{{ grav_path }}/{{ item.site_hostname }}/{{ item.site_hostname }}-pages/{{ item.pages_folder }}" force: yes become: yes become_user: "{{ grav_user }}" loop: "{{ grav_website_repo }}" + tags: websites - name: "[Repos] - Remove pages dir" file: path: "{{ grav_path }}/{{ item.site_hostname }}/site/user/pages" state: absent loop: "{{ grav_website_repo }}" + tags: websites - name: "[Repos] - Symlink pages path" file: @@ -34,4 +45,5 @@ state: link owner: "{{ grav_user }}" group: "{{ grav_group }}" - loop: "{{ grav_website_repo }}" \ No newline at end of file + loop: "{{ grav_website_repo }}" + tags: websites